-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Disable NODE_ENV detection during install #8827
Comments
I would be OK with "Option 1" (installing all dependencies, when NODE_ENV is set to `production). I don't know what @pnpm/collaborators think. The reason this works like this currently is that npm CLI does it like this. Yarn seems to install everything. We can do it in v10 if we decide it soon. |
Also, the args are a bit confusing Since the possible default behavior will be to install all dependencies pnpm can have |
Personally, I'm not particularly satisfied with either option. I checked the documentation for npm and yarn. They are consistent in handling
Ref:
The handling method of npm and yarn is: If you want to install all dependencies after setting My main concerns are:
|
UPD: Looks like dev deps in package json has been install, but probably by possible mistake in some prod deps where i.e. webpack was not in dev deps and by hoisting I were able to see webpack in node_modules and didn't notice NODE_ENV=production behavior during install So yeah, looks like yarn doesn't install dev deps under |
I checked with the latest Yarn and it installed dev deps. |
Yes, looks like latest Yarn version installs dev deps under |
If the behavior of yarn is to install everything, then I prefer option 1. |
I think option 1 makes more sense. |
Normally, I would prefer pnpm to not behave differently from Yarn and NPM, but Yarn and NPM are behaving differently themselves. In this case, installing everything including dev dependencies rarely break anyone's workflow (unless they don't have enough disk space), so I prefer option 1. |
What about the arguments, maybe it is only me, but the fact that Also, their combination is not clean from the first glance, like |
Contribution
Describe the user story
There is automatic detection of NODE_ENV and as a result some dependencies could be omitted during install https://pnpm.io/cli/install#--prod--p
Sometimes you have set NODE_ENV before install, i.e.
NODE_ENV=production
and then all dev dependencies will not be installed, but they are required for build. The things can be even more complicated when install command is running by some wrapper tool, and you do not have a way to bypass flags to pnpmAlso, there can be a problem on CI where NODE_ENV can be set globally for a job
Describe the solution you'd like
Option 1 - disable defaults for
--prod
and NODE_ENV detection, always install all dependencies unless explicit flag is set to install only specific set of dependenciesOption 2 - add a config property to
.npmrc
to skip NODE_ENV detection and install all dependenciesDescribe the drawbacks of your solution
No response
Describe alternatives you've considered
No response
The text was updated successfully, but these errors were encountered: