-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathwebpack.config.js
74 lines (64 loc) · 1.69 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
const TerserPlugin = require("terser-webpack-plugin");
const path = require("path");
const env = process.env.NODE_ENV || "development";
module.exports = {
entry: `${__dirname}/src/index.tsx`,
output: {
filename: "bundle.js",
path: path.join(process.cwd(), "static")
},
externals: {
"katex": "katex",
"liqvid": "Liqvid",
"rangetouch": "RangeTouch",
"react": "React",
"react-dom": "ReactDOM",
"three": "THREE",
"three/examples/jsm/controls/FlyControls": "THREE.FlyControls",
"three/examples/jsm/controls/OrbitControls": "THREE.OrbitControls",
"three/examples/jsm/lines/Line2": "THREE.Line2",
"three/examples/jsm/lines/LineGeometry": "THREE.LineGeometry",
"three/examples/jsm/lines/LineMaterial": "THREE.LineMaterial",
"three/examples/jsm/loaders/SVGLoader": "THREE",
"three/examples/jsm/objects/MarchingCubes": "THREE.MarchingCubes",
"three/examples/jsm/utils/GeometryUtils": "THREE.GeometryUtils"
},
mode: env,
module: {
rules: [
{
test: /\.[jt]sx?$/,
loader: "ts-loader"
}
],
},
// necessary due to bug in old versions of mobile Safari
devtool: false,
optimization: {
minimizer: [
new TerserPlugin({
parallel: true,
terserOptions: {
safari10: true
}
})
],
emitOnErrors: true
},
resolve: {
extensions: [".ts", ".tsx", ".js", ".jsx", ".json"],
alias: {
"@lib": `${__dirname}/lib`,
"@env": path.join(__dirname, "src", "@" + env),
"@src": path.join(__dirname, "src")
}
},
resolveLoader: {
modules: [
path.join(__dirname, "node_modules")
]
},
snapshot: {
managedPaths: []
}
};