-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.prod.js
60 lines (58 loc) · 1.5 KB
/
webpack.prod.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const SpeedMeasureWebpackPlugin = require("speed-measure-webpack-plugin");
const BundleAnalyzerPlugin = require("webpack-bundle-analyzer").BundleAnalyzerPlugin;
const Jarvis = require("webpack-jarvis");
const TerserPlugin = require("terser-webpack-plugin");
const HardSourceWebpackPlugin = require("hard-source-webpack-plugin");
const smp = new SpeedMeasureWebpackPlugin();
module.exports = smp.wrap({
mode: "production",
entry: "./src/index.js",
output: {
path: path.resolve(__dirname, "dist"),
filename: "bundle.js"
},
resolve: {
modules: [path.resolve(__dirname, "node_modules")]
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
use: "babel-loader?cacheDirectory=true",
include: [path.resolve(__dirname, "src")]
},
{
test: /\.css$/,
use: [MiniCssExtractPlugin.loader, "css-loader"],
include: [path.resolve(__dirname, "src")]
}
]
},
optimization: {
minimizer: [
new TerserPlugin({
parallel: true,
cache: true
})
]
},
plugins: [
new HtmlWebpackPlugin({
template: path.resolve(__dirname, "src/index.html"),
filename: "index.html"
}),
new MiniCssExtractPlugin(),
new BundleAnalyzerPlugin(),
new HardSourceWebpackPlugin()
// new webpack.DllReferencePlugin({
// manifest: require('./build/library/library.json')
// })
// new Jarvis({
// watchOnly: true,
// port: 10086
// })
]
});