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

--no-optional-dependencies not working as expected #216

Closed
http417 opened this issue Apr 22, 2020 · 8 comments
Closed

--no-optional-dependencies not working as expected #216

http417 opened this issue Apr 22, 2020 · 8 comments

Comments

@http417
Copy link

http417 commented Apr 22, 2020

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 dependency npm 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.

@jugglingcats
Copy link

jugglingcats commented Oct 14, 2020

Related to #82 which seems to have gone stale.

@gojko when I run npm i --production --no-optional, the aws-sdk doesn't appear anywhere under node_modules for me but still appears in my package. Am sure this was working fine in the past.

@jugglingcats
Copy link

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?

@danomatic
Copy link

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.

@danomatic
Copy link

danomatic commented Apr 18, 2021

^ this is with latest Node (14). After downgrading to 13, claudia update no longer fails due to size (from aws-sdk and others).

@danomatic
Copy link

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

@lehno
Copy link

lehno commented May 12, 2021

Any resolution on this?

@danielg-cf
Copy link
Contributor

Fixed. PR is pending #225.

@gojko
Copy link
Member

gojko commented Oct 18, 2021

thanks, this is now published as v 5.14.0

@gojko gojko closed this as completed Oct 18, 2021
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

6 participants