When I run webpack-dev-server it compiles fine, but when I save a file that is being watched by this plugin, I get the following error:
Compilation Started after change of - source/app/vocabs/english.json
node_modules/filewatcher-webpack-plugin/index.js:45
if (err) throw err;
^
ConcurrentCompilationError: You ran Webpack twice. Each instance only supports a single concurrent compilation at a time.
at Compiler.run (node_modules/webpack/lib/Compiler.js:149:37)
It may be because I'm compiling multiple JS files at a time, or it could be that I'm using Webpack v4...? Here is my Webpack config:
const webpackConfig = {
entry: {
'app': `./source/app/app.js`,
'widget': `./source/widget/app.js`,
},
output: {
path: path.resolve(__dirname, `${config.outputDir}/assets/`),
publicPath: `${config.outputDir}/assets/`,
filename: '[name].js',
libraryTarget: `amd`,
},
devServer: {
contentBase: __dirname,
compress: true,
port: 1031,
disableHostCheck: true,
host: `0.0.0.0`, // needed for hot reloading to work (binds to all hosts)
https: {
key: fs.readFileSync(`${pathToCerts}/device.key`),
cert: fs.readFileSync(`${pathToCerts}/${root_domain}.crt`),
},
before: beforeCompile, // function defined earlier in file
after: afterCompile, // function defined earlier in file
},
mode: (shell && shell.NODE_ENV) ? shell.NODE_ENV : `development`,
module: {
rules: [{
test: /\.js$/,
use: {
loader: 'babel-loader',
options: {
presets: [['env', {
targets: {
browsers: ['ie 9'],
},
useBuiltIns: true,
loose: true,
}]],
},
},
}],
},
externals: [
'vocab',
'wrapper',
],
plugins: [
new filewatcherPlugin({watchFileRegex: ['**/vocabs/*.json']}),
],
};
return webpackConfig;
};