-
Notifications
You must be signed in to change notification settings - Fork 3
/
rspack.config.js
44 lines (39 loc) · 1.18 KB
/
rspack.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
// @ts-check
const rspack = require("@rspack/core")
const date = new Date()
const buildDate = `${date.getFullYear().toString().padStart(4, "0")}${(date.getMonth() + 1)
.toString()
.padStart(2, "0")}${date.getDate().toString().padStart(2, "0")}${date.getHours().toString().padStart(2, "0")}${date
.getMinutes()
.toString()
.padStart(2, "0")}${date.getSeconds().toString().padStart(2, "0")}`
const isProduction = process.env.NODE_ENV === "production"
/** @type {import('@rspack/cli').Configuration} */
const config = {
entry: "./src/app.ts",
output: {
filename: "bundle.js",
path: "./dist/",
},
module: {
rules: [
{
test: /\.ts$/,
use: "builtin:swc-loader",
},
],
},
devServer: { static: { directory: "./dist/" } },
plugins: [
new rspack.DefinePlugin({
"process.env.SERVER_URL": JSON.stringify(process.env.SERVER_URL),
"process.env.BUILD_DATE": JSON.stringify(buildDate),
"process.env.CREDITS": JSON.stringify(process.env.CREDITS),
}),
new rspack.ProvidePlugin({
process: [require.resolve("process/browser")],
}),
],
devtool: isProduction ? false : "source-map",
}
module.exports = config