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

When used with Lerna, a cache directory is created in several different locations #82

Closed
damienwebdev opened this issue Mar 28, 2019 · 4 comments

Comments

@damienwebdev
Copy link

damienwebdev commented Mar 28, 2019

  • Operating System: MacOS v10.14.3
  • Node Version: v10.15.0
  • NPM Version:6.7.0
  • Webpack Version:
@angular-devkit/[email protected]
  ├── [email protected] 
  └─┬ [email protected]
    └── [email protected]  deduped

Expected Behavior

When using lerna for hoisted package management in a monorepo, when I do run lerna run build and it runs the build script in each of my packages, the resulting cache directory should be in my root node_modules of my project.

Actual Behavior

When using lerna for hoisted package management, when I do run lerna run build and it runs the build script in each of my packages, ng build runs webpack with terser-webpack-plugin with the cache flag set to true. This generates a new node_modules directory in each of my source directories.

How Do We Reproduce?

You can reproduce fairly easily by cloning: https://github.com/graycoreio/daffodil and then:

npm install -g lerna @angular/cli
lerna run build
look in apps/daffio/ and see a new node_modules folder
@alexander-akait
Copy link
Member

@damienwebdev we use https://github.com/avajs/find-cache-dir for detect cache directory, better create issue in their repo, as workaround you can setup path in configuration

@alexander-akait
Copy link
Member

Close in favor sindresorhus/find-cache-dir#14

@damienwebdev
Copy link
Author

damienwebdev commented May 14, 2019

@evilebottnawi See @sindresorhus 's comment I don't think there are any plans to change this, so I think the next step is to find a different find-cache-dir implementation that allows for configuration, utilize it here, and then make changes in @angular/angular-cli to take advantage of it.

@alexander-akait
Copy link
Member

alexander-akait commented May 14, 2019

@damienwebdev we provide cache option (https://github.com/webpack-contrib/terser-webpack-plugin#cache), you can implement any behavior. You can add example to docs.

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

2 participants