-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.ts
93 lines (90 loc) · 1.99 KB
/
webpack.config.ts
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
82
83
84
85
86
87
88
89
90
91
92
93
import * as path from 'path';
import * as webpack from 'webpack';
import 'webpack-dev-server';
import HtmlWebpackPlugin from 'html-webpack-plugin';
import {CleanWebpackPlugin} from "clean-webpack-plugin";
import CopyPlugin from "copy-webpack-plugin";
import TerserPlugin from "terser-webpack-plugin";
const config: webpack.Configuration = {
context: path.resolve(__dirname, 'src'),
entry: './game.ts',
output: {
filename: "bundle.min.js"
},
optimization: {
minimizer: [
new TerserPlugin({
terserOptions: {
output: {
comments: false
},
compress: {
drop_console: true,
drop_debugger: true,
pure_funcs: ['console.log'],
},
}
})
]
},
module: {
rules: [
{
test: /\.ts$/,
include: path.resolve(__dirname, 'src'),
loader: 'ts-loader'
},
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: "babel-loader"
}
},
{
test: [/\.vert$/, /\.frag$/],
use: "raw-loader"
},
{
test: /\.css$/,
use: "css-loader"
},
{
test: /\.(gif|png|jpe?g|svg|xml|ttf|mp3)$/i,
loader: "file-loader",
options: {
name: '[name].[ext]',
outputPath: 'assets'
}
}
]
},
devServer: {
static: path.join(__dirname, 'dist')
},
resolve: {
extensions: ['.ts', '.js']
},
plugins: [
new HtmlWebpackPlugin({
template: path.resolve(__dirname, 'src/index.html'),
title: 'Generative Agents Dev',
inject: 'head'
}),
// https://github.com/johnagan/clean-webpack-plugin
new CleanWebpackPlugin(),
new CopyPlugin({
patterns: [
{
from: 'assets',
to: 'assets'
}
],
}),
new webpack.DefinePlugin({
CANVAS_RENDERER: JSON.stringify(true),
WEBGL_RENDERER: JSON.stringify(true)
}),
]
};
export default config;