@esmx/rspack 3.0.0-rc.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -0
- package/dist/app.d.ts +160 -0
- package/dist/app.mjs +130 -0
- package/dist/build-target.d.ts +8 -0
- package/dist/build-target.mjs +0 -0
- package/dist/config.d.ts +8 -0
- package/dist/config.mjs +142 -0
- package/dist/html-app.d.ts +299 -0
- package/dist/html-app.mjs +214 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.mjs +7 -0
- package/dist/loader.d.ts +30 -0
- package/dist/loader.mjs +33 -0
- package/dist/pack.d.ts +2 -0
- package/dist/pack.mjs +69 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.mjs +1 -0
- package/dist/utils/rsbuild.d.ts +12 -0
- package/dist/utils/rsbuild.mjs +97 -0
- package/package.json +108 -0
- package/src/app.ts +319 -0
- package/src/build-target.ts +8 -0
- package/src/config.ts +171 -0
- package/src/html-app.ts +560 -0
- package/src/index.ts +12 -0
- package/src/loader.ts +34 -0
- package/src/pack.ts +79 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/rsbuild.ts +105 -0
package/README.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# @esmx/rspack
|
|
2
|
+
|
|
3
|
+
基于 Rspack 提供高性能的构建能力,支持标准应用和 HTML 应用的开发与构建。
|
|
4
|
+
|
|
5
|
+
## 特性
|
|
6
|
+
|
|
7
|
+
- 🚀 **高性能构建** - 基于 Rspack 的极速构建,为应用提供卓越的开发体验
|
|
8
|
+
- 💡 **应用支持** - 完整支持标准应用和 HTML 应用的开发与构建
|
|
9
|
+
- 🎨 **资源处理** - 智能处理各类资源,支持 JavaScript、CSS、图片等
|
|
10
|
+
- 🛠️ **SSR 支持** - 内置服务端渲染支持,轻松构建同构应用
|
|
11
|
+
- 🔧 **开发体验** - 支持热更新、智能提示和 TypeScript
|
|
12
|
+
|
|
13
|
+
## 安装
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pnpm add @esmx/rspack -D
|
|
17
|
+
# 或
|
|
18
|
+
yarn add @esmx/rspack -D
|
|
19
|
+
# 或
|
|
20
|
+
npm install @esmx/rspack -D
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## 文档
|
|
24
|
+
|
|
25
|
+
访问 [@esmx/rspack 官方文档](https://www.esmnext.com/api/app/rspack.html) 获取详细的使用指南和 API 文档。
|
|
26
|
+
|
|
27
|
+
## 许可证
|
|
28
|
+
|
|
29
|
+
MIT
|
package/dist/app.d.ts
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { type App, type Esmx } from '@esmx/core';
|
|
2
|
+
import type { RspackOptions } from '@rspack/core';
|
|
3
|
+
import type { BuildTarget } from './build-target';
|
|
4
|
+
/**
|
|
5
|
+
* Rspack 应用配置上下文接口。
|
|
6
|
+
*
|
|
7
|
+
* 该接口提供了在配置钩子函数中可以访问的上下文信息,允许你:
|
|
8
|
+
* - 访问 Esmx 框架实例
|
|
9
|
+
* - 获取当前的构建目标(client/server/node)
|
|
10
|
+
* - 修改 Rspack 配置
|
|
11
|
+
* - 访问应用选项
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* // entry.node.ts
|
|
16
|
+
* export default {
|
|
17
|
+
* async devApp(esmx) {
|
|
18
|
+
* return import('@esmx/rspack').then((m) =>
|
|
19
|
+
* m.createRspackApp(esmx, {
|
|
20
|
+
* // 配置钩子函数
|
|
21
|
+
* config(context) {
|
|
22
|
+
* // 访问构建目标
|
|
23
|
+
* if (context.buildTarget === 'client') {
|
|
24
|
+
* // 修改客户端构建配置
|
|
25
|
+
* context.config.optimization = {
|
|
26
|
+
* ...context.config.optimization,
|
|
27
|
+
* splitChunks: {
|
|
28
|
+
* chunks: 'all'
|
|
29
|
+
* }
|
|
30
|
+
* };
|
|
31
|
+
* }
|
|
32
|
+
* }
|
|
33
|
+
* })
|
|
34
|
+
* );
|
|
35
|
+
* }
|
|
36
|
+
* };
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export interface RspackAppConfigContext {
|
|
40
|
+
/**
|
|
41
|
+
* Esmx 框架实例。
|
|
42
|
+
* 可用于访问框架提供的 API 和工具函数。
|
|
43
|
+
*/
|
|
44
|
+
esmx: Esmx;
|
|
45
|
+
/**
|
|
46
|
+
* 当前的构建目标。
|
|
47
|
+
* - 'client': 客户端构建,生成浏览器可执行的代码
|
|
48
|
+
* - 'server': 服务端构建,生成 SSR 渲染代码
|
|
49
|
+
* - 'node': Node.js 构建,生成服务器入口代码
|
|
50
|
+
*/
|
|
51
|
+
buildTarget: BuildTarget;
|
|
52
|
+
/**
|
|
53
|
+
* Rspack 编译配置对象。
|
|
54
|
+
* 你可以在配置钩子中修改这个对象来自定义构建行为。
|
|
55
|
+
*/
|
|
56
|
+
config: RspackOptions;
|
|
57
|
+
/**
|
|
58
|
+
* 创建应用时传入的选项对象。
|
|
59
|
+
*/
|
|
60
|
+
options: RspackAppOptions;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Rspack 应用配置选项接口。
|
|
64
|
+
*
|
|
65
|
+
* 该接口提供了创建 Rspack 应用时可以使用的配置选项,包括:
|
|
66
|
+
* - 代码压缩选项
|
|
67
|
+
* - Rspack 配置钩子函数
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```ts
|
|
71
|
+
* // entry.node.ts
|
|
72
|
+
* export default {
|
|
73
|
+
* async devApp(esmx) {
|
|
74
|
+
* return import('@esmx/rspack').then((m) =>
|
|
75
|
+
* m.createRspackApp(esmx, {
|
|
76
|
+
* // 禁用代码压缩
|
|
77
|
+
* minimize: false,
|
|
78
|
+
* // 自定义 Rspack 配置
|
|
79
|
+
* config(context) {
|
|
80
|
+
* if (context.buildTarget === 'client') {
|
|
81
|
+
* context.config.optimization.splitChunks = {
|
|
82
|
+
* chunks: 'all'
|
|
83
|
+
* };
|
|
84
|
+
* }
|
|
85
|
+
* }
|
|
86
|
+
* })
|
|
87
|
+
* );
|
|
88
|
+
* }
|
|
89
|
+
* };
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
export interface RspackAppOptions {
|
|
93
|
+
/**
|
|
94
|
+
* 是否启用代码压缩。
|
|
95
|
+
*
|
|
96
|
+
* - true: 启用代码压缩
|
|
97
|
+
* - false: 禁用代码压缩
|
|
98
|
+
* - undefined: 根据环境自动判断(生产环境启用,开发环境禁用)
|
|
99
|
+
*
|
|
100
|
+
* @default undefined
|
|
101
|
+
*/
|
|
102
|
+
minimize?: boolean;
|
|
103
|
+
/**
|
|
104
|
+
* Rspack 配置钩子函数。
|
|
105
|
+
*
|
|
106
|
+
* 在构建开始前调用,可以通过该函数修改 Rspack 的编译配置。
|
|
107
|
+
* 支持针对不同的构建目标(client/server/node)进行差异化配置。
|
|
108
|
+
*
|
|
109
|
+
* @param context - 配置上下文,包含框架实例、构建目标和配置对象
|
|
110
|
+
*/
|
|
111
|
+
config?: (context: RspackAppConfigContext) => void;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* 创建 Rspack 应用实例。
|
|
115
|
+
*
|
|
116
|
+
* 该函数根据运行环境(开发/生产)创建不同的应用实例:
|
|
117
|
+
* - 开发环境:配置热更新中间件和实时渲染
|
|
118
|
+
* - 生产环境:配置构建任务
|
|
119
|
+
*
|
|
120
|
+
* @param esmx - Esmx 框架实例
|
|
121
|
+
* @param options - Rspack 应用配置选项
|
|
122
|
+
* @returns 返回应用实例
|
|
123
|
+
*
|
|
124
|
+
* @example
|
|
125
|
+
* ```ts
|
|
126
|
+
* // entry.node.ts
|
|
127
|
+
* export default {
|
|
128
|
+
* async devApp(esmx) {
|
|
129
|
+
* return import('@esmx/rspack').then((m) =>
|
|
130
|
+
* m.createRspackApp(esmx, {
|
|
131
|
+
* config(context) {
|
|
132
|
+
* // 配置 loader 处理不同类型的文件
|
|
133
|
+
* context.config.module = {
|
|
134
|
+
* rules: [
|
|
135
|
+
* {
|
|
136
|
+
* test: /\.ts$/,
|
|
137
|
+
* exclude: [/node_modules/],
|
|
138
|
+
* loader: 'builtin:swc-loader',
|
|
139
|
+
* options: {
|
|
140
|
+
* jsc: {
|
|
141
|
+
* parser: {
|
|
142
|
+
* syntax: 'typescript'
|
|
143
|
+
* }
|
|
144
|
+
* }
|
|
145
|
+
* }
|
|
146
|
+
* },
|
|
147
|
+
* {
|
|
148
|
+
* test: /\.css$/,
|
|
149
|
+
* use: ['style-loader', 'css-loader']
|
|
150
|
+
* }
|
|
151
|
+
* ]
|
|
152
|
+
* };
|
|
153
|
+
* }
|
|
154
|
+
* })
|
|
155
|
+
* );
|
|
156
|
+
* }
|
|
157
|
+
* };
|
|
158
|
+
* ```
|
|
159
|
+
*/
|
|
160
|
+
export declare function createRspackApp(esmx: Esmx, options?: RspackAppOptions): Promise<App>;
|
package/dist/app.mjs
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import { pathToFileURL } from "node:url";
|
|
3
|
+
import { styleText } from "node:util";
|
|
4
|
+
import {
|
|
5
|
+
PathType,
|
|
6
|
+
RenderContext,
|
|
7
|
+
createApp,
|
|
8
|
+
mergeMiddlewares
|
|
9
|
+
} from "@esmx/core";
|
|
10
|
+
import { createVmImport } from "@esmx/import";
|
|
11
|
+
import hotMiddleware from "webpack-hot-middleware";
|
|
12
|
+
import { createRspackConfig } from "./config.mjs";
|
|
13
|
+
import { pack } from "./pack.mjs";
|
|
14
|
+
import { createRsBuild } from "./utils/index.mjs";
|
|
15
|
+
export async function createRspackApp(esmx, options) {
|
|
16
|
+
const app = await createApp(esmx, esmx.command);
|
|
17
|
+
switch (esmx.command) {
|
|
18
|
+
case esmx.COMMAND.dev:
|
|
19
|
+
app.middleware = mergeMiddlewares([
|
|
20
|
+
...await createMiddleware(esmx, options),
|
|
21
|
+
app.middleware
|
|
22
|
+
]);
|
|
23
|
+
app.render = rewriteRender(esmx);
|
|
24
|
+
break;
|
|
25
|
+
case esmx.COMMAND.build:
|
|
26
|
+
app.build = rewriteBuild(esmx, options);
|
|
27
|
+
break;
|
|
28
|
+
}
|
|
29
|
+
return app;
|
|
30
|
+
}
|
|
31
|
+
async function createMiddleware(esmx, options = {}) {
|
|
32
|
+
if (esmx.command !== esmx.COMMAND.dev) {
|
|
33
|
+
return [];
|
|
34
|
+
}
|
|
35
|
+
const rsBuild = createRsBuild([
|
|
36
|
+
generateBuildConfig(esmx, options, "client"),
|
|
37
|
+
generateBuildConfig(esmx, options, "server")
|
|
38
|
+
]);
|
|
39
|
+
rsBuild.watch();
|
|
40
|
+
const hot = hotMiddleware(rsBuild.compilers[0], {
|
|
41
|
+
path: `${esmx.basePath}hot-middleware`
|
|
42
|
+
});
|
|
43
|
+
return [
|
|
44
|
+
(req, res, next) => {
|
|
45
|
+
if (req.url?.startsWith(`${esmx.basePath}hot-middleware`)) {
|
|
46
|
+
return hot(req, res, next);
|
|
47
|
+
}
|
|
48
|
+
return next();
|
|
49
|
+
}
|
|
50
|
+
];
|
|
51
|
+
}
|
|
52
|
+
function generateBuildConfig(esmx, options, buildTarget) {
|
|
53
|
+
const config = createRspackConfig(esmx, buildTarget, options);
|
|
54
|
+
options.config?.({ esmx, options, buildTarget, config });
|
|
55
|
+
return config;
|
|
56
|
+
}
|
|
57
|
+
function rewriteRender(esmx) {
|
|
58
|
+
return async (options) => {
|
|
59
|
+
const baseURL = pathToFileURL(esmx.root);
|
|
60
|
+
const importMap = await esmx.getImportMap("server");
|
|
61
|
+
const vmImport = createVmImport(baseURL, importMap);
|
|
62
|
+
const rc = new RenderContext(esmx, options);
|
|
63
|
+
const module = await vmImport(
|
|
64
|
+
`${esmx.name}/src/entry.server`,
|
|
65
|
+
import.meta.url,
|
|
66
|
+
{
|
|
67
|
+
console,
|
|
68
|
+
setTimeout,
|
|
69
|
+
clearTimeout,
|
|
70
|
+
process,
|
|
71
|
+
URL,
|
|
72
|
+
global
|
|
73
|
+
}
|
|
74
|
+
);
|
|
75
|
+
const serverRender = module[rc.entryName];
|
|
76
|
+
if (typeof serverRender === "function") {
|
|
77
|
+
await serverRender(rc);
|
|
78
|
+
}
|
|
79
|
+
return rc;
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
function rewriteBuild(esmx, options = {}) {
|
|
83
|
+
return async () => {
|
|
84
|
+
for (const item of esmx.moduleConfig.exports) {
|
|
85
|
+
if (item.type === PathType.root) {
|
|
86
|
+
const text = fs.readFileSync(
|
|
87
|
+
esmx.resolvePath("./", item.exportPath),
|
|
88
|
+
"utf-8"
|
|
89
|
+
);
|
|
90
|
+
if (/\bexport\s+\*\s+from\b/.test(text)) {
|
|
91
|
+
console.log(
|
|
92
|
+
styleText(
|
|
93
|
+
"red",
|
|
94
|
+
`The export * syntax is used in the file '${item.exportPath}', which will cause the packaging to fail.`
|
|
95
|
+
)
|
|
96
|
+
);
|
|
97
|
+
console.log(
|
|
98
|
+
styleText(
|
|
99
|
+
"red",
|
|
100
|
+
`Please use specific export syntax, such as export { a, b } from './a';`
|
|
101
|
+
)
|
|
102
|
+
);
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
await createRsBuild([
|
|
108
|
+
generateBuildConfig(esmx, options, "client"),
|
|
109
|
+
generateBuildConfig(esmx, options, "server"),
|
|
110
|
+
generateBuildConfig(esmx, options, "node")
|
|
111
|
+
]).build();
|
|
112
|
+
esmx.writeSync(
|
|
113
|
+
esmx.resolvePath("dist/index.js"),
|
|
114
|
+
`
|
|
115
|
+
async function start() {
|
|
116
|
+
const options = await import('./node/src/entry.node.js').then(
|
|
117
|
+
(mod) => mod.default
|
|
118
|
+
);
|
|
119
|
+
const { Esmx } = await import('@esmx/core');
|
|
120
|
+
const esmx = new Esmx(options);
|
|
121
|
+
|
|
122
|
+
await esmx.init(esmx.COMMAND.start);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
start();
|
|
126
|
+
`.trim()
|
|
127
|
+
);
|
|
128
|
+
return pack(esmx);
|
|
129
|
+
};
|
|
130
|
+
}
|
|
File without changes
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Esmx } from '@esmx/core';
|
|
2
|
+
import { type RspackOptions } from '@rspack/core';
|
|
3
|
+
import type { RspackAppOptions } from './app';
|
|
4
|
+
import type { BuildTarget } from './build-target';
|
|
5
|
+
/**
|
|
6
|
+
* 构建 Client、Server、Node 的基础配置
|
|
7
|
+
*/
|
|
8
|
+
export declare function createRspackConfig(esmx: Esmx, buildTarget: BuildTarget, options: RspackAppOptions): RspackOptions;
|
package/dist/config.mjs
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { moduleLinkPlugin } from "@esmx/rspack-module-link-plugin";
|
|
2
|
+
import {
|
|
3
|
+
rspack
|
|
4
|
+
} from "@rspack/core";
|
|
5
|
+
import nodeExternals from "webpack-node-externals";
|
|
6
|
+
export function createRspackConfig(esmx, buildTarget, options) {
|
|
7
|
+
const isWebApp = buildTarget === "client" || buildTarget === "server";
|
|
8
|
+
const isHot = buildTarget === "client" && !esmx.isProd;
|
|
9
|
+
return {
|
|
10
|
+
/**
|
|
11
|
+
* 项目根目录,不可修改
|
|
12
|
+
*/
|
|
13
|
+
context: esmx.root,
|
|
14
|
+
entry: (() => {
|
|
15
|
+
const importPaths = [];
|
|
16
|
+
switch (buildTarget) {
|
|
17
|
+
case "client":
|
|
18
|
+
importPaths.push(esmx.resolvePath("src/entry.client.ts"));
|
|
19
|
+
isHot && importPaths.push(
|
|
20
|
+
`${resolve("webpack-hot-middleware/client")}?path=${esmx.basePath}hot-middleware&timeout=5000&overlay=false`
|
|
21
|
+
);
|
|
22
|
+
break;
|
|
23
|
+
case "server":
|
|
24
|
+
importPaths.push(esmx.resolvePath("src/entry.server.ts"));
|
|
25
|
+
break;
|
|
26
|
+
case "node":
|
|
27
|
+
importPaths.push(esmx.resolvePath("src/entry.node.ts"));
|
|
28
|
+
break;
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
[`./src/entry.${buildTarget}`]: {
|
|
32
|
+
import: importPaths
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
})(),
|
|
36
|
+
output: {
|
|
37
|
+
clean: esmx.isProd,
|
|
38
|
+
module: true,
|
|
39
|
+
chunkFormat: esmx.isProd ? "module" : void 0,
|
|
40
|
+
chunkLoading: esmx.isProd ? "import" : void 0,
|
|
41
|
+
chunkFilename: esmx.isProd ? "chunks/[name].[contenthash:8].final.js" : "chunks/[name].js",
|
|
42
|
+
library: {
|
|
43
|
+
type: esmx.isProd ? "modern-module" : "module"
|
|
44
|
+
},
|
|
45
|
+
filename: buildTarget !== "node" && esmx.isProd ? "[name].[contenthash:8].final.js" : "[name].js",
|
|
46
|
+
cssFilename: esmx.isProd ? "[name].[contenthash:8].final.css" : "[name].css",
|
|
47
|
+
cssChunkFilename: esmx.isProd ? "chunks/[name].[contenthash:8].final.css" : "chunks/[name].css",
|
|
48
|
+
publicPath: buildTarget === "client" ? "auto" : `${esmx.basePathPlaceholder}${esmx.basePath}`,
|
|
49
|
+
uniqueName: esmx.varName,
|
|
50
|
+
hotUpdateChunkFilename: "__hot__/[id].[fullhash].hot-update.js",
|
|
51
|
+
hotUpdateMainFilename: "__hot__/[runtime].[fullhash].hot-update.json",
|
|
52
|
+
path: (() => {
|
|
53
|
+
switch (buildTarget) {
|
|
54
|
+
case "client":
|
|
55
|
+
return esmx.resolvePath("dist/client");
|
|
56
|
+
case "server":
|
|
57
|
+
return esmx.resolvePath("dist/server");
|
|
58
|
+
case "node":
|
|
59
|
+
return esmx.resolvePath("dist/node");
|
|
60
|
+
}
|
|
61
|
+
})(),
|
|
62
|
+
environment: {
|
|
63
|
+
nodePrefixForCoreModules: true
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
// 默认插件,不可修改
|
|
67
|
+
plugins: (() => {
|
|
68
|
+
return [
|
|
69
|
+
// 进度条插件
|
|
70
|
+
new rspack.ProgressPlugin({
|
|
71
|
+
prefix: buildTarget
|
|
72
|
+
}),
|
|
73
|
+
// 模块链接插件
|
|
74
|
+
isWebApp ? moduleLinkPlugin(esmx.moduleConfig) : false,
|
|
75
|
+
// 热更新插件
|
|
76
|
+
isHot ? new rspack.HotModuleReplacementPlugin() : false
|
|
77
|
+
];
|
|
78
|
+
})(),
|
|
79
|
+
module: {
|
|
80
|
+
parser: {
|
|
81
|
+
javascript: {
|
|
82
|
+
url: buildTarget === "client" ? true : "relative",
|
|
83
|
+
importMeta: false,
|
|
84
|
+
strictExportPresence: true
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
generator: {
|
|
88
|
+
asset: {
|
|
89
|
+
emit: buildTarget === "client"
|
|
90
|
+
},
|
|
91
|
+
"asset/resource": {
|
|
92
|
+
emit: buildTarget === "client"
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
rules: []
|
|
96
|
+
},
|
|
97
|
+
resolve: {
|
|
98
|
+
alias: {
|
|
99
|
+
[esmx.name]: esmx.root
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
optimization: {
|
|
103
|
+
minimize: options.minimize ?? esmx.isProd,
|
|
104
|
+
avoidEntryIife: esmx.isProd,
|
|
105
|
+
concatenateModules: esmx.isProd,
|
|
106
|
+
emitOnErrors: true,
|
|
107
|
+
splitChunks: {
|
|
108
|
+
chunks: "async"
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
externalsPresets: {
|
|
112
|
+
web: buildTarget === "client",
|
|
113
|
+
node: buildTarget === "server" || buildTarget === "node"
|
|
114
|
+
},
|
|
115
|
+
externalsType: "module-import",
|
|
116
|
+
externals: (() => {
|
|
117
|
+
if (buildTarget === "node") {
|
|
118
|
+
return [
|
|
119
|
+
// @ts-ignore
|
|
120
|
+
nodeExternals({
|
|
121
|
+
// @ts-ignore
|
|
122
|
+
importType: "module-import"
|
|
123
|
+
})
|
|
124
|
+
];
|
|
125
|
+
}
|
|
126
|
+
return [];
|
|
127
|
+
})(),
|
|
128
|
+
experiments: {
|
|
129
|
+
outputModule: true,
|
|
130
|
+
parallelCodeSplitting: true,
|
|
131
|
+
rspackFuture: {
|
|
132
|
+
bundlerInfo: { force: false }
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
target: buildTarget === "client" ? "web" : "node22.6",
|
|
136
|
+
mode: esmx.isProd ? "production" : "development",
|
|
137
|
+
cache: !esmx.isProd
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
function resolve(name) {
|
|
141
|
+
return new URL(import.meta.resolve(name)).pathname;
|
|
142
|
+
}
|