I have a wepback.config.js file with the following plugin structure:
/**************************************************
Plugins imported:
const HtmlWebpackPlugin = require('html-webpack-plugin');
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
const HtmlWebpackInlineSourcePlugin = require('html-webpack-inline-source-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
*********************************************************/
plugins: [
new HtmlWebpackPlugin({
inlineSource: '(main.bundle.js)',
template: './web/leafletReact.html',
inject: 'body'
}),
new webpack.optimize.UglifyJsPlugin({
// Eliminate comments
comments: false,
// Compression specific options
compress: {
// remove warnings
warnings: false,
// Drop console statements
drop_console: true
},
}),
new HtmlWebpackInlineSourcePlugin(),
new CopyWebpackPlugin([
{
from: path.join(__dirname, '/build/*.html'),
to: path.join(__dirname, '/assets/dist'),
toType: 'dir',
flatten: true
}
])
]
Even though CopyWebpackPlugin is listed last, it runs prior to the completion of HtmlWebpackInlineSourcePlugin . Is there a way to force CopyWebpackPlugin to wait until all the other plugins are finished?
For anyone having this issue please use FileManagerWebpackPlugin. Since copy-webpack-plugin
is not designed to wait for the build to complete hence the error. Hope this helps anybody having the same problems. Cheers, sigfried.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With