-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
50 lines (47 loc) · 1.16 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
import path from "node:path";
import URL from "node:url";
import fs from "node:fs";
const __filename = URL.fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
export default {
entry: {
'main': './src/lib/main.ts',
'workers/frame': './src/lib/workers/frame.ts',
'workers/photons': './src/lib/workers/photons.ts',
...fs.readdirSync("./src/scenes")
.filter(file => file.endsWith(".ts"))
.reduce((acc, file) => (acc["scenes/" + file.slice(0, -3)] = './src/scenes/' + file, acc), {})
},
output: {
filename: '[name].bundle.js',
path: path.resolve(__dirname, 'dist', 'js')
},
module: {
rules: [
{
test: /\.ts$/,
use: 'ts-loader',
exclude: /node_modules/
}
]
},
devtool: 'source-map',
mode: "development",
resolve: {
extensions: ['.ts', '.js'],
alias: {
'@': path.resolve(__dirname, 'src/lib/')
}
},
devServer: {
static: {
directory: path.join(__dirname, 'dist'),
},
headers: {
"Cross-Origin-Opener-Policy": "same-origin",
"Cross-Origin-Embedder-Policy": "require-corp"
},
compress: true,
port: 9000
}
};