-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrspack.config.ts
54 lines (49 loc) · 1.18 KB
/
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
48
49
50
51
52
53
54
import { Configuration } from "@rspack/cli";
import { BannerPlugin } from "@rspack/core";
import path from "path";
import pkg from "./package.json";
import configJson from "./src/config.json";
const pluginConfig = configJson as Record<string, string>;
pluginConfig.version = pkg.version;
const meta = (() => {
const lines = ["/**"];
for (const key in pluginConfig) {
lines.push(` * @${key} ${pluginConfig[key]}`);
}
lines.push(" */");
return lines.join("\n");
})();
const config: Configuration = {
mode: "development",
target: "node",
devtool: false,
entry: "./src/index.ts",
module: {
rules: [
{
test: /\.ts$/,
exclude: [/node_modules/],
loader: "builtin:swc-loader",
options: {
sourceMap: true,
jsc: {
parser: {
syntax: "typescript",
},
},
},
type: "javascript/auto",
},
],
},
output: {
filename: "UnreadVoiceText.plugin.js",
path: path.join(__dirname, "dist"),
library: {
type: "commonjs2",
export: "default",
},
},
plugins: [new BannerPlugin({ raw: true, banner: meta })],
};
export default config;