-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
63 lines (62 loc) · 1.61 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
const HtmlWebpackPlugin = require("html-webpack-plugin");
const CopyPlugin = require("copy-webpack-plugin");
const path = require("path");
module.exports = {
entry: {
index: "./src/index.js",
car: "./src/car.js",
knight: "./src/knight.js",
demo: "./src/demo.js"
},
output: {
path: path.resolve(__dirname, "./docs"),
filename: "[name]_bundle.js",
},
plugins: [
new HtmlWebpackPlugin({
filename: "index.html",
chunks: ['index'],
template: "./template/index.html"
}),
new HtmlWebpackPlugin({
filename: "car.html",
chunks: ['car'],
template: "./template/car.html"
}),
new HtmlWebpackPlugin({
filename: "knight.html",
chunks: ['knight'],
template: "./template/index.html"
}),
new HtmlWebpackPlugin({
filename: "demo.html",
chunks: ['demo'],
template: "./template/index.html"
}),
process.env.NODE_ENV ==='production' ? new CopyPlugin({
patterns: [
{ from: path.join(__dirname, "modal"), to: path.join(__dirname, "docs") },
{ from: path.join(__dirname, "music"), to: path.join(__dirname, "docs") },
],
}) : ''
],
devServer: {
contentBase: [path.join(__dirname, "modal"), path.join(__dirname, "docs"), path.join(__dirname, "music")],
port: 3000,
proxy: {
"/api": "http://localhost:8080",
},
},
module: {
rules: [
{
test: /\.css$/,
use: ["style-loader", "css-loader"],
},
{
test: /\.(woff|woff2|ttf|eot|jpg|png)$/,
use: "file-loader?name=fonts/[name].[ext]!static",
},
],
},
};