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

Feature request: detect webpack.DefinePlugin usage and dirty the cache on value change #495

Open
EdwardDrapkin opened this issue Apr 5, 2019 · 2 comments

Comments

@EdwardDrapkin
Copy link

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?

@cursedcoder
Copy link

+1, this is something that can harm users

@iajun
Copy link

iajun commented Aug 31, 2020

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

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

3 participants