-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
81 lines (78 loc) · 1.66 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
79
80
81
const HtmlWebpackPlugin = require("html-webpack-plugin");
const { CheckerPlugin } = require("awesome-typescript-loader");
const path = require("path");
const basePath = __dirname;
module.exports = {
mode: "development",
context: path.join(basePath, "src"),
resolve: {
alias: {
common: path.resolve(basePath, "./src/common"),
core: path.resolve(basePath, "./src/core"),
layout: path.resolve(basePath, "./src/layout"),
model: path.resolve(basePath, "./src/model"),
pods: path.resolve(basePath, "./src/pods"),
scenes: path.resolve(basePath, "./src/scenes"),
},
extensions: [".js", ".ts", ".tsx"],
},
entry: {
app: ["regenerator-runtime/runtime", "./index.tsx"],
},
devtool: "source-map",
output: {
path: path.join(basePath, "dist"),
filename: "[name].js",
},
devServer: {
inline: true,
host: "localhost",
port: 8080,
stats: "minimal",
},
module: {
rules: [
{
test: /\.tsx?$/,
exclude: /node_modules/,
loader: "awesome-typescript-loader",
options: {
useBabel: true,
babelCore: "@babel/core", // needed for Babel v7
},
},
{
test: /\.css$/,
exclude: /node_modules/,
use: ["style-loader", "css-loader"],
},
{
test: /\.(png|jpg|gif|svg)$/,
exclude: /node_modules/,
loader: "file-loader",
options: {
name: "assets/img/[name].[ext]?[hash]",
},
},
],
},
optimization: {
splitChunks: {
cacheGroups: {
vendor: {
chunks: "all",
name: "vendor",
test: /[\\/]node_modules[\\/]/,
enforce: true,
},
},
},
},
plugins: [
new HtmlWebpackPlugin({
filename: "index.html",
template: "index.html",
}),
new CheckerPlugin(),
],
};