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

Exclude src/ from published npm package #3334

Closed
roblg opened this issue Feb 21, 2018 · 6 comments
Closed

Exclude src/ from published npm package #3334

roblg opened this issue Feb 21, 2018 · 6 comments

Comments

@roblg
Copy link

roblg commented Feb 21, 2018

RxJS version:

At least version 5.5.6

Expected behavior:

src/ folder (in particular, the BUILD.bazel file) is excluded from published npm package.

Actual behavior:

src/ folder including BUILD.bazel file is included in published npm package, and gets picked up by our bazel in node_modules (we're currently using bazel primarily for Java, and not yet for JS for development):

(08:20:56) ERROR: error loading package 'node_modules/rxjs/src': Extension file not found. Unable to load package for '@build_bazel_rules_typescript//:defs.bzl': The repository could not be resolved

Additional information:

Love that you're using bazel in an open source JS project! <3 Bazel.

@kwonoj
Copy link
Member

kwonoj commented Feb 21, 2018

I'm not entirely sure if it's accident to include bazel, what I vaguely remember is it is intended for ng build process. /cc @alexeagle for clarity.

In any cases, at this point we don't officially support bazel-based build (as a build process of consumer application's build steps) yet, expect something might not work.

@alexeagle
Copy link
Contributor

@roblg Bazel is descending into the node_modules/rxjs folder because you didn't tell it that it's a separate workspace.

Just add

local_repository(name = "rxjs", path = "node_modules/rxjs/src")

to your WORKSPACE file, then these targets won't be picked up in your build unless you use a label like @rxjs//:some-label

@roblg
Copy link
Author

roblg commented Feb 21, 2018

Thanks for the suggestion @alexeagle. I agree that that will work to fix this specific instance, but that doesn't really seem like a long-term solution. (I'd hate to have to randomly go add things to our WORKSPACE that happen to end up in node_modules during local development. What happens if we get a dependency conflict, and we end up with two copies in node_modules?). From our perspective, rxjs isn't a bazel dependency at all, it's just an npm package that we depend on (transitively) that happens to contain its src/ folder, which has a BUILD file in it.

I'm not super familiar with this project (it's only a transitive dependency of... something. I'm not even sure what yet... 😬). Is there a reason that it ships src/ in the published package?

If rxjs needs to ship src/BUILD, we can work around it locally; just seems suboptimal...

@alexeagle
Copy link
Contributor

I've discussed with @benlesh about switching rxjs off the package.json scripts and onto Bazel. I think as part of that, we should change the model for how Bazel users get rxjs - they should have a WORKSPACE dep on the rxjs source tree, not on the npm published package.

One problem is version skew - we don't have a good way for npm to fetch version 6.0.0 for example, while making sure that Bazel WORKSPACE doesn't fetch 6.0.1.

I need to find some time to use https://github.com/pubref/rules_node and understand it better, then maybe discuss with @pcj

@benlesh
Copy link
Member

benlesh commented Feb 24, 2018

src/ is being used for source maps

@lock
Copy link

lock bot commented Jun 5, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants