-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
42 lines (42 loc) · 1.06 KB
/
webpack.config.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 { CleanWebpackPlugin } = require("clean-webpack-plugin");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const { resolve } = require("path");
module.exports = {
entry: {
index: "./src/index.js",
login: "./src/a.js",
},
output: {
path: resolve(__dirname, "./build"),
filename: "[name].js", //用占位符替代
},
resolveLoader: {
modules: ["./node_modules", "./myloader"],
},
module: {
rules: [
// {
// test: /\.less$/,
// use: ["style-loader", "css-loader", "less-loader"], //从后向前
// },
{
test: /\.less$/,
use: ["mystyle", "mycss", "myless"], //从后向前
},
],
},
plugins: [
new HtmlWebpackPlugin({
template: "./src/public/index.html", //指定模板
filename: "index.html",
chunks: ["index"], //区分html中导入的js模块
}),
new HtmlWebpackPlugin({
template: "./src/public/login.html",
filename: "login.html",
chunks: ["login"],
}),
new CleanWebpackPlugin(),
],
mode: "production",
};