Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: support npm workspaces #74

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

asabil
Copy link

@asabil asabil commented May 10, 2023

No description provided.

@asabil
Copy link
Author

asabil commented May 10, 2023

Not ready to merge yet, due to the function assetNameFromFilePath which makes assumptions about the location of node_modules/

    function assetNameFromFilePath(path: string): string {
        if (path.startsWith(compilerRoot)) {
            return path.substring(compilerRoot.length);
        }

        if (path.startsWith(projectRoot)) {
            return path.substring(projectRoot.length);
        }

        throw new Error(`unexpected file path: ${path}`);
    }

Would something like this fix it?

    function assetNameFromFilePath(path: string): string {
        if (path.startsWith(compilerRoot)) {
            return path.substring(compilerRoot.length);
        }

        if (path.startsWith(projectRoot)) {
            return path.substring(projectRoot.length);
        }

        if (path.includes("node_modules/")) {
            return path.replace(/.+node_modules\//, "");
        }

        throw new Error(`unexpected file path: ${path}`);
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant