--no-optional-dependencies not working as expected
http417 opened this issue · comments
Please use GitHub issues only to report bugs. To ask a general question or request assistance/support, please use the Claudia.js Gitter Chat instead.
To report a bug or a problem, please fill in the sections below. The more you provide, the better we'll be able to help.
-
Expected behaviour:
optional dependencies such as aws-sdk are not included in zip -
What actually happens:
aws-sdk is included. -
Link to a minimal, executable project that demonstrates the problem:
-
Steps to install the project:
install aws-sdk as optional dependencynpm i -O aws-sdk
-
Steps to reproduce the problem:
claudia update --no-optional-dependencies
-
Please note
it appears that claudia packages with the following npm command:
npm install -q --no-package-lock --no-audit --production --no-optional
if I remove the --no-package-lock option, then the optional dependencies are correctly omitted.
Possibly an npm version issue or something else in local environment. Have just looked at the package created as part of deployment (using Github action) and it doesn't contain aws-sdk! Maybe a Windows issue?
After battling this for hours today, I THINK the issue is the npm dedupe
. You can reproduce with:
rm -rf package-lock.json node_modules
npm install --no-optional --production
At this point aws-sdk
is not installed
npm dedupe --no-optional --production
Still not installed
npm dedupe
Now it's installed
Running claudia update
with --no-optional-dependencies
does not apply --no-optional --production
when running npm dedupe
This is a total blocker for me. The size of the bundle is so large that my deploys are failing now.
^ this is with latest Node (14). After downgrading to 13, claudia update
no longer fails due to size (from aws-sdk and others).
More specifically, it's NPM 7 where Claudia has the issue with dedupe
. It should be fixed to add the --no-optional --production
flags. In the meantime, the workaround is to install NPM 6:
npm install -g npm@^6
Any resolution on this?
Fixed. PR is pending #225.
thanks, this is now published as v 5.14.0