hard-source-webpack-plugin
hard-source-webpack-plugin copied to clipboard
environmentHash is not detecting changes to yarn.lock and not invalidating cache
My config
new HardSourceWebpackPlugin({
cacheDirectory : isDevServer
? Helpers.root('./.cache/hard-source/dev/[confighash]')
: isDebug
? Helpers.root('./.cache/hard-source/debug/[confighash]')
: Helpers.root('./.cache/hard-source/prod/[confighash]'),
recordsPath : isDevServer
? Helpers.root('./.cache/hard-source/dev/[confighash]/records.json')
: isDebug
? Helpers.root('./.cache/hard-source/debug/[confighash]/records.json')
: Helpers.root('./.cache/hard-source/prod/[confighash]/records.json'),
configHash : require('node-object-hash')({ sort: false }).hash,
environmentHash: {
directories: ['node_modules'],
files : ['npm-shrinkwrap.json', 'yarn.lock'],
root : process.cwd()
}
}),
Anytime yarn.lock or npm-shrinkwrap.json changes, it should invalidate the cache. However, it simply is not doing that. Therefore, any time I add a new package via npm install newpackage -S or yarn add newpackage the cache is immediately invalid and the build breaks. I have to manually delete .cache folder almost every day.
Anyone there?
Probably too late to the party, but my first guess would be that root: process.cwd() is probably pointing at the wrong directory.
Assuming your config file lives in the root, something like root: __dirname may produce the result you're expecting. __dirname always points to the directory containing the file.