-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
46 lines (42 loc) · 1.01 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
import { readdirSync } from 'fs'
import { resolve } from 'path'
const DIR = resolve('./ssr/script')
let entry = {}
readdirSync(DIR)
.filter(f => f.endsWith('.ts'))
.forEach(i => {
let e = i.substring(0, i.lastIndexOf('.'))
entry[e] = resolve(DIR, i)
})
const Config = {
mode: 'production',
entry,
output: {
path: resolve('./static/ssr/script'),
clean: true,
filename: '[name].js',
sourceMapFilename: 'source_maps/[file].map',
assetModuleFilename: 'assets/[hash][ext][query]',
},
module: {
rules: [
{
test: /\.(ts|tsx)$/,
exclude: /node_modules/,
use: 'ts-loader',
},
],
},
devtool: 'source-map',
plugins: [],
resolve: {
extensions: ['.mjs', '.tsx', '.ts', '.js'],
plugins: [],
},
optimization: {
emitOnErrors: false,
chunkIds: 'deterministic',
minimize: true,
},
}
export default Config