Skip to content

Instantly share code, notes, and snippets.

@victors1681
Last active December 17, 2018 00:07
Show Gist options
  • Save victors1681/94c418cae460885ae04da7ccb6d3cc4c to your computer and use it in GitHub Desktop.
Save victors1681/94c418cae460885ae04da7ccb6d3cc4c 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()
].filter(plugin => plugin);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment