Closed damienwebdev closed 5 years ago
As a simple solution, what could be done is to check to see if a node_modules
directory exists in the cwd
if there isn't one, recursively check up the tree until you hit a node_modules
directory. This may be dangerous though, so it may make sense to stop at the "project boundary". How find-cache-dir
determines the project boundary may be difficult though.
@sindresorhus could I get a review of this issue, the number of polluting node_modules
is becoming pretty problematic for me.
This module is working just fine, it doesn't need to be aware of monorepo semantics. If you're using Lerna in "hoisted" mode, you should be running your build from the root, not the leaves. Otherwise, it's on you to configure your webpack plugins' cache
settings appropriately.
MacOS v10.14.3
v10.15.0
6.7.0
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 rootnode_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 withterser-webpack-plugin
with thecache
flag set to true. This generates a newnode_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:
I was redirected here from https://github.com/webpack-contrib/terser-webpack-plugin/issues/82