-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrspack.config.ts
47 lines (44 loc) · 1023 Bytes
/
rspack.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
import { paths } from './env.ts'
import { join } from 'path'
import HtmlRspackPluginModule from '@rspack/plugin-html'
import { DotenvPlugin } from 'rspack-plugin-dotenv'
// some weird issue with how rspack handles module imports/exports
// also seems to work differently in docker than dev environment
const HtmlRspackPlugin =
(HtmlRspackPluginModule as any).default || HtmlRspackPluginModule
const config = {
entry: {
main: `./app/web/index.tsx`,
},
output: {
filename: 'main.js',
path: paths.dist,
},
plugins: [
new DotenvPlugin(),
new HtmlRspackPlugin({
template: join(paths.web, 'index.html'),
}),
],
module: {
rules: [
{
test: /\.tsx?$/,
loader: 'esbuild-loader',
options: {
tsconfig: './tsconfig.json',
},
},
{
test: /\.txt$/,
use: ['file-loader'],
},
],
},
}
export default (_: unknown, flags: any) => {
return {
...config,
mode: flags.mode ?? 'development',
}
}