hard-source-webpack-plugin
hard-source-webpack-plugin copied to clipboard
Feature request: detect webpack.DefinePlugin usage and dirty the cache on value change
We use HardSource and we love it. It's been a huge boon to our productivity, so many thanks.
One thing we run into fairly frequently is that we use the DefinePlugin in webpack to define some API keys and such, and when those change, we have to blow away the cache. It's not a huge deal, but it is a little annoying to have to blow away the entire cache instead of just the files that need to be recompiled with the new DefinePlugin'd values. Is it possible for you guys to detect usage of that plugin, then detect the files the plugin actually applies to, and dirty them in the cache?
+1, this is something that can harm users
new HardSourceWebpackPlugin({
cacheDirectory: path.resolve(__dirname, '../.cache/hard-source/[confighash]'),
info: {
mode: 'none',
level: 'error',
},
environmentHash: {
root: process.cwd(),
directories: ['config'],
files: ['package-lock.json', 'yarn.lock'],
},
}),
By adding my env files into environmentHash dirs, I solved it