Reputation: 168
I wrote a plugin, mainly provide mock data for requests, since this part is purely standalone, so in entry file it's not imported, which means webpack can't track this mock data's change. So how to manually add this mock folder to webpack and make it can be watched during developing ? Thanks!
Upvotes: 1
Views: 765
Reputation: 35473
You can use extra-watch-webpack-plugin in order to add an additional files / dirs to webpack watch.
Or you can implement a similar thing that it implemented.
compiler.hooks.afterCompile.tap('after-compile', compilation => {
// for adding a specific file
fileDependencies.forEach(file => {
compilation.fileDependencies.add(resolve(file));
});
// for adding a dir
dirDependencies.forEach(dir => {
compilation.contextDependencies.add(dir);
});
});
Upvotes: 1