-
Notifications
You must be signed in to change notification settings - Fork 31
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
What about undeclared dynamic dependencies? #73
Comments
Ping @pcj in case you don't check new issues in this repo very often. |
I see your point. My personal opinion is that implicit/undeclared dependencies in npm modules should be regarded as bugs. As an npm library developer I SHOULD declare all my dependencies. For bazel, it would seem that end-users / application develops will need to be aware of these undeclared dependencies and explicitly declare them. Granted I'm sure this is an over-simplification. WDYT? |
Yeah, I agree with that, but it's unfortunate that program behavior changes
when run under Bazel. Will make it harder to get wide-scale adoption. I'm
glad you didn't encounter that problem in rules_node yet, maybe it's very
uncommon to rely on this.
I think for now we'll add optionalDependency in packages we control that
have this problem, and maybe have some way in our new design for
rules_nodejs that lets you specify these invisible deps in the
`yarn_install` rule.
…On Fri, Aug 24, 2018 at 8:35 AM Paul Cody Johnston ***@***.***> wrote:
I see your point.
My personal opinion is that these implicit/undeclared dependencies in npm
modules is a bug. As an npm library developer I SHOULD declare all my
dependencies. For bazel, it would seem that end-users / application
develops will need to be aware of these dependencies and explicitly declare
them.
Granted I'm sure this is an over-simplification. WDYT?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#73 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAC5I5uu24_kbfWEq9jCRRp3YVwSjvtgks5uUB0zgaJpZM4WKwfm>
.
|
Do you have a concrete example? Could be a foundation to educate community better. |
We just made a change to Angular, such that the closure compiler compat layer ( |
I don't think using Packages are meant to handle a missing optional dependency gracefully at runtime. For example, For the Thoughts? |
I'm bumping into this again in bazelbuild/rules_typescript#398 |
I think we are settling on |
@alexeagle did |
npm has the semantics that all programs see the entire node_modules tree. This allows libraries to have the dubious behavior "I don't declare any kind of dependency on foolib in my package.json, but if you just install foolib into your project, I'll have different behavior". That's because a program can just
try { require('foolib') }
and have conditional behavior based on whether it was found.It seems to me that any formulation of individual npm packages under bazel, where a package's dependencies are expected to be declared statically, is going to have the flaw that some program behavior no longer works because the dynamic lookup of foolib fails when it's not in the declared action inputs.
Have you thought about this at all?
The text was updated successfully, but these errors were encountered: