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

fix webpack watch rebuild loop #279

Merged
merged 1 commit into from
Feb 4, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions webpack.config.default.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,31 @@ if (!isDebug) {
}

if (isDebug && useHMR) {
/*
class WatchRunPlugin {
apply(compiler) {
compiler.hooks.watchRun.tap('WatchRun', (comp) => {
if (comp.modifiedFiles) {
const changedFiles = Array.from(comp.modifiedFiles, (file) => `\n ${file}`).join('');
console.log('===============================');
console.log('FILES CHANGED:', changedFiles);
console.log('===============================');
}
if (comp.removedFiles) {
const removedFiles = Array.from(comp.removedFiles, (file) => `\n ${file}`).join('');
console.log('===============================');
console.log('FILES REMOVED:', removedFiles);
console.log('===============================');
}
//console.log(comp)
});
}
}
config.plugins.push(new WatchRunPlugin);
*/
config.watchOptions = {
ignored: /public/, //because sass-loader causes rebuild loop otherwise
};
config.entry.unshift('webpack-hot-middleware/client');
config.plugins.push(new webpack.HotModuleReplacementPlugin());
config.optimization = {
Expand Down