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

devDependencies and hoisting problem #91

Closed
bestander opened this issue Jul 4, 2016 · 7 comments
Closed

devDependencies and hoisting problem #91

bestander opened this issue Jul 4, 2016 · 7 comments

Comments

@bestander
Copy link
Member

Npm3 does not hoist devDependencies because hoisting of devDependencies will affect the overall node_modules structure of regular dependencies.
Then npm install --prod and --dev may have possibly different application node_modules and it may cause unexpected app behaviour.

Any idea if this issue affects us and whether we should do the same?

@sebmck
Copy link
Contributor

sebmck commented Jul 5, 2016

One way we could fix this would be to ignore devDependencies in the linking phase when in prod mode, we'd still have to fetch all the modules to resolve them and everything but it's probably not that bad (lockfile mitigates network io).

@bestander
Copy link
Member Author

I like the idea

@shayne
Copy link
Contributor

shayne commented Jul 6, 2016

This issue was brought up recently when a react-oss-js test assumed that it could copy the "react" module out of react-native-github/node_modules/ and it would contain its dependencies. This wasn't the case due to the hoisting approach we currently have.

The test itself was questionably implemented so it shouldn't be a nail in the coffin for the way we currently handle devDependencies, rather, another data-point.

@sebmck
Copy link
Contributor

sebmck commented Jul 6, 2016

npm (to my knowledge) doesn't handle devDependencies differently by not hoisting them so I'm not sure why this behaviour should be relied on?

@bestander
Copy link
Member Author

I'll find a link tomorrow, I think I came around this issue on GitHub/npm.

On Thursday, 7 July 2016, Sebastian McKenzie [email protected]
wrote:

npm (to my knowledge) doesn't handle devDependencies differently by not
hoisting them so I'm not sure why this behaviour should be relied on?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#91 (comment), or mute
the thread
https://github.com/notifications/unsubscribe/ACBdWEP85X8f3Bj3MxngUecCOHeaLZxDks5qTD3CgaJpZM4JEhYd
.

@bestander
Copy link
Member Author

You are right, @kittens, I was misguided that this is the behaviour of npm 3 but it is not.
However there are discussions about this situation npm/npm#11287

@bdentino
Copy link

sorry to drudge up an old issue, but was there ever any further discussion of this? is it possibly related to #1462? There seems to be a discrepancy between how yarn and npm hoist modules that are shared by packages specified in dependencies and devDependencies when installing with --production. I've been running into situations where yarn install --prod results in 'module not found' errors because a dependency of a dependency isn't pulled to the top-level like it is with npm.

arcanis added a commit that referenced this issue Sep 13, 2018
Implements a super basic offline cache integration
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

No branches or pull requests

4 participants