This repository has been archived by the owner on Sep 30, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathwebpack.config.js
68 lines (66 loc) · 1.56 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
var path = require('path');
var buildPath = path.resolve('dist');
module.exports = (env) => ({
mode: (() => {
return env && env.production ? 'production' : 'development';
})(),
entry: './index.ts',
resolve: {
extensions: ['.tsx', '.ts', '.js', '.json'],
symlinks: false,
alias: {
fs: 'memfs',
readline: 'fakereadline',
},
},
module: {
rules: [
// all files with a '.ts' or '.tsx' extension will be handled by 'ts-loader'
{ test: /\.tsx?$/, use: ['ts-loader'], exclude: /node_modules(?!\/voxelservercore)/ },
],
},
performance: {
// change the default size warnings
maxEntrypointSize: 1.5e6,
maxAssetSize: 1.5e6,
},
entry: {
bundle: './src/index.ts',
protocol: './src/lib/helpers/protocol.ts',
inflate: './src/lib/helpers/worldInflate.ts',
server: './src/lib/singleplayer/server/server.ts',
normalWorker: './node_modules/voxelsrv-server/dist/default/worldgen/normalWorker.js',
},
output: {
filename: '[name].js',
globalObject: 'globalThis',
},
devServer: {
contentBase: buildPath,
inline: true,
host: '0.0.0.0',
stats: 'minimal',
headers: {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, PATCH, OPTIONS',
'Access-Control-Allow-Headers': 'X-Requested-With, content-type, Authorization',
},
},
watchOptions: {
aggregateTimeout: 500,
poll: 1000,
ignored: ['node_modules'],
},
optimization: {
splitChunks: {
cacheGroups: {
babylon: {
chunks: 'initial',
test: /babylonjs/,
filename: 'babylon.js',
},
},
},
},
plugins: [],
});