https://github.com/webpack/webpack/issues/2223#issuecomment-216944768
Should we use cacheDirectory to fix it?
We already have cacheDirectory: true, isn't that supposed to use the system temp directory?
cc @hzoo
Sorry, I actually haven't used that option before, code is here
If the value is blank (loader: 'babel-loader?cacheDirectory') the loader will use the default OS temporary file directory.
This is due to how npm works when run as root user
See https://github.com/MoOx/phenomic/issues/545
I suggest using this package to avoid this problem https://github.com/avajs/find-cache-dir
What are the relevant packages we need to send PRs to?
Is it babel-loader?
@thangngoc89 Would you be interested in doing so?
We need to setup it up in babel-loader setting.
const cacheDir = findCacheDir({name: 'create-react-app'})
// webpack loaders config
babel-loader?cacheDirectory=cacheDir
From now on, babel-loader will use ./node_modules/.cache/create-react-app as it caches folder
If you accept this solution, I would be happy to send out a PR
Sounds good if you can make it work. Ideally I鈥檇 avoid using node_modules for cache though because people are going to measure it and complain CRA has too many dependencies. 馃槃
Hey. What about this issue?
@zelenin Sorry, I forgot this. This will be my first thing to do tomorrow. For now, don't run this in docker with root user.
Why didn鈥檛 we send a PR to babel-loader itself to use findCacheDir({ name: 'babel-loader' }) by default? Wouldn鈥檛 that make more sense than special-casing it here?
I've sent a PR to babel-loader now.
This should be fixed in 0.4.2.
Please verify!