-
Notifications
You must be signed in to change notification settings - Fork 56
/
webpack.plugins.js
42 lines (36 loc) · 1.01 KB
/
webpack.plugins.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
const path = require("path");
const CopyWebpackPlugin = require("copy-webpack-plugin");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer");
const isProduction = process.env.NODE_ENV === "production";
const copyWebpackPlugin = new CopyWebpackPlugin({
patterns: [
{
from: "**/*.*",
to: "assets",
context: "src/assets",
},
{
from: "**/*.*",
to: ".",
context: "src/static",
},
],
});
const htmlWebpackPlugin = new HtmlWebpackPlugin({
title: "fusliez notes",
minify: isProduction,
template: path.resolve(__dirname, "src", "templates", "index.template.html"),
});
const cleanWebpackPlugin = new CleanWebpackPlugin();
const bundleAnalyzerPlugin = new BundleAnalyzerPlugin({
analyzerMode: "static",
openAnalyzer: false,
});
module.exports = [
cleanWebpackPlugin,
copyWebpackPlugin,
htmlWebpackPlugin,
bundleAnalyzerPlugin,
];