-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
78 lines (77 loc) · 1.72 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
const packageJson = require("./package.json");
const NODE_ENV = process.env.NODE_ENV || "development";
const DEV_PORT = 9999;
const publicPath = `https://localhost:${DEV_PORT}/assets/`; // also for HMR
module.exports = {
mode: NODE_ENV,
entry: {
main: "./js/Main.jsx",
articles: "./js/Articles.jsx",
about: "./js/About.jsx",
post: "./js/Post.jsx",
},
output: {
path: `${__dirname}/build`,
filename: "[name].js",
libraryTarget: "umd",
library: packageJson.name,
publicPath,
},
module: {
rules: [
{
test: /\.(ts|js)x?$/,
use: "babel-loader",
exclude: /node_modules/,
},
{
test: /\.css$/,
use: [
"style-loader",
{
loader: "css-loader",
options: {
importLoaders: 1,
modules: true,
},
},
],
include: /\.module\.css$/,
},
{
test: /\.css$/,
use: ["style-loader", "css-loader"],
exclude: /\.module\.css$/,
},
{
test: /\.less$/,
use: ["style-loader", "css-loader", "less-loader"],
exclude: /node_modules/,
},
{
test: /\.(woff(2)?|ttf|eot|svg)(\?v=\d+\.\d+\.\d+)?$/,
use: "file-loader",
},
],
},
resolve: {
extensions: [".ts", ".tsx", ".js", ".jsx"],
},
devServer: {
contentBase: __dirname,
disableHostCheck: true,
headers: {
"Access-Control-Allow-Origin": "*",
},
https: true,
port: DEV_PORT,
publicPath,
// key: "./dev.key.pem",
// cert: "./dev.pem",
host: "localhost", // 'localhost' HMR debuggable
historyApiFallback: {
index: "index.html",
},
},
externals: {},
};