Skip to content

Instantly share code, notes, and snippets.

@BiosBoy
Created January 12, 2019 22:54
Show Gist options
  • Save BiosBoy/48da3d0b6fbd159e2b5baaed9281f38c to your computer and use it in GitHub Desktop.
Save BiosBoy/48da3d0b6fbd159e2b5baaed9281f38c to your computer and use it in GitHub Desktop.
// ------------------------------------
// STAGE PLUGINS INJECTION! [DEVELOPMENT, PRODUCTION, TESTING]
// ------------------------------------
const stagePlugins = {
test: [new BundleAnalyzerPlugin()],
development: [
new HtmlWebpackPlugin({
template: path.resolve('./src/index.html'),
filename: 'index.html',
inject: 'body',
minify: false,
chunksSortMode: 'auto'
}),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoEmitOnErrorsPlugin()
],
production: [
new MiniCssExtractPlugin({
filename: '[name].[hash].css',
chunkFilename: '[name].[hash].css'
}),
new HtmlWebpackPlugin({
template: path.resolve('./src/index.html'),
filename: 'index.html',
inject: 'body',
minify: {
collapseWhitespace: true
},
chunksSortMode: 'auto'
})
]
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment