Closed durad closed 1 year ago
@ricardogobbosouza we should save our warnins/errors in cache and restore it for cached files/modules
Is there any progress with this issue?
@alexander-akait Do you have any webpack cache api documentation?
oh, don't see, let's open an issue in webpack docs site, anyway it is easy, here simple example https://github.com/webpack-contrib/terser-webpack-plugin/blob/master/src/index.js#L334
asset - > getLazyHashedEtag (hash)
-> getItemCache
(get cached stuff associated with name and hash, because one file (name) can have many cached files with different hashes, for example own file and source maps) -> getPromise
(get cached file) -> storePromise
(store file in cache)
In your case you need store module (resourcePath maybe?) and associated errors/warnings
Thanks, i will analyze
Any update on this or ideas for a workaround? This is blocking us from moving to Webpack v5 and we aren't able to come up with a way around it.
Edit: Came up with a gross workaround - if you force ESLintPlugin to run for all files (ignoring the webpack cache) and enable its built in caching, you can get similar build speed without losing the initial lints:
class ESLintPluginNoCache extends ESLintPlugin {
async run(compiler, ...args) {
if (!compiler.hooks.compilation.taps.find(({ name }) => name === ESLINT_PLUGIN_NOCACHE)) {
compiler.hooks.compilation.tap(ESLINT_PLUGIN_NOCACHE, (compilation) => {
compilation.hooks.succeedModule.intercept({
register: (tapInfo) => {
if (tapInfo.name === this.key) {
compilation.hooks.stillValidModule.tap(this.key, tapInfo.fn);
}
return tapInfo;
}
});
});
}
return super.run(compiler, ...args);
}
}
Sadly this setup really chugs if you enable threads and relies so much on ESLintPlugin's internals that it could easily be broken by an update, but it seems to be working well enough for now.
Hi @kowsen I will look into it soon
Any progress on this one?
Has the problem been solved
Any chage!
Bug report
Actual Behavior
With webpack cache turned on and set to 'filesystem' ESLintPlugin reports errors only after first build. If files are unchanged and build is started again ESLintPlugin will not report any errors/warnings.
Expected Behavior
ESLintPlugin should always report same errors/warnings for same input files consistently regardless of the webpack cache.
How Do We Reproduce?
Minimal repo: https://github.com/durad/webpack-eslint-caching-issue
Clone, run
yarn install
and then runyarn build
twice. Warning will be shown only the first time.Please paste the results of
npx webpack-cli info
here, and mention other relevant informationSame happens with both development and production mode.