-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshack.config.mjs
44 lines (43 loc) · 1.01 KB
/
shack.config.mjs
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
import { dirname, join } from 'path'
import { fileURLToPath } from 'url'
import HtmlWebpackPlugin from 'html-webpack-plugin'
import ExtraCodeWebpackPlugin from 'extra-code-webpack-plugin'
export default {
entry: './web/index.tsx',
module: {
rules: [
{
test: /\.tsx?$/,
loader: "ts-loader",
options: {
compilerOptions: {
module: "ESNext",
}
}
}
]
},
resolve: {
extensions: [".ts", ".tsx", ".js", ".mjs", ".cjs"]
},
plugins: [
new HtmlWebpackPlugin({
title: 'my-react',
template: join(dirname(fileURLToPath(import.meta.url)), 'web', 'index.html'),
}),
new ExtraCodeWebpackPlugin({
codes: ({ isDev, isEntry }) => (isDev && isEntry) ? `
// @ts-ignore
import.meta.webpackHot.accept()` : ``
})
],
output: {
path: join(dirname(fileURLToPath(import.meta.url)), 'dist', 'web'),
filename: '[contenthash].js'
},
optimization: {
splitChunks: {
chunks: 'all',
},
},
}