Skip to content

Instantly share code, notes, and snippets.

@victors1681
Created December 17, 2018 00:08
Show Gist options
  • Save victors1681/b9d610d08b7525bd0a7cc674bfb0b6ff to your computer and use it in GitHub Desktop.
Save victors1681/b9d610d08b7525bd0a7cc674bfb0b6ff to your computer and use it in GitHub Desktop.
const getPlugins = env =>
[
new HtmlWebpackPlugin({
filename: "index.html",
template: path.join(__dirname, "public/index.html"),
inject: true,
chunks: ["app", "vendors"]
}),
env.analyze && new BundleAnalyzerPlugin(),
new MiniCssExtractPlugin({
filename: env.NODE_ENV === "development" ? "[name].css" : "css/[name].[chunkhash:8].css"
}),
env.NODE_ENV === "development" && new webpack.HotModuleReplacementPlugin(),
env.NODE_ENV === "production" && new CleanWebpackPlugin(['myDistribution/ui/js', 'myDistribution/ui/css'])
].filter(plugin => plugin);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment