@lark-apaas/fullstack-rspack-preset 1.0.32-alpha.33 → 1.0.32-alpha.35
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/lib/preset.js +12 -13
- package/package.json +2 -2
package/lib/preset.js
CHANGED
|
@@ -58,24 +58,23 @@ function createRecommendRspackConfig(options) {
|
|
|
58
58
|
const releaseId = process.env.RELEASE_ID || new Date().toISOString();
|
|
59
59
|
// 读取构建前生成的路由定义 JSON,供 DefinePlugin 注入到 bundle
|
|
60
60
|
// build.sh 在 client 构建之前已将 page-routes.json / api-routes.json 写入 dist/
|
|
61
|
+
// 独立于 needRoutes(needRoutes 仅控制 RouteParserPlugin),只要文件存在就注入
|
|
61
62
|
let pageRouteDefinitions = [];
|
|
62
63
|
let apiRouteDefinitions = [];
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
pageRouteDefinitions = JSON.parse(fs_1.default.readFileSync(pageRoutesPath, 'utf-8'));
|
|
68
|
-
}
|
|
64
|
+
try {
|
|
65
|
+
const pageRoutesPath = path_1.default.resolve(rootDir, 'dist/page-routes.json');
|
|
66
|
+
if (fs_1.default.existsSync(pageRoutesPath)) {
|
|
67
|
+
pageRouteDefinitions = JSON.parse(fs_1.default.readFileSync(pageRoutesPath, 'utf-8'));
|
|
69
68
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
69
|
+
}
|
|
70
|
+
catch { /* ignore */ }
|
|
71
|
+
try {
|
|
72
|
+
const apiRoutesPath = path_1.default.resolve(rootDir, 'dist/api-routes.json');
|
|
73
|
+
if (fs_1.default.existsSync(apiRoutesPath)) {
|
|
74
|
+
apiRouteDefinitions = JSON.parse(fs_1.default.readFileSync(apiRoutesPath, 'utf-8'));
|
|
76
75
|
}
|
|
77
|
-
catch { /* ignore */ }
|
|
78
76
|
}
|
|
77
|
+
catch { /* ignore */ }
|
|
79
78
|
return {
|
|
80
79
|
mode: isDev ? 'development' : 'production',
|
|
81
80
|
cache: false,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lark-apaas/fullstack-rspack-preset",
|
|
3
|
-
"version": "1.0.32-alpha.
|
|
3
|
+
"version": "1.0.32-alpha.35",
|
|
4
4
|
"files": [
|
|
5
5
|
"lib",
|
|
6
6
|
"patches",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@babel/parser": "^7.28.0",
|
|
32
32
|
"@babel/traverse": "^7.28.0",
|
|
33
33
|
"@babel/types": "^7.28.2",
|
|
34
|
-
"@lark-apaas/devtool-kits": "1.2.17-alpha.
|
|
34
|
+
"@lark-apaas/devtool-kits": "1.2.17-alpha.48",
|
|
35
35
|
"@lark-apaas/miaoda-inspector-babel-plugin": "^1.0.2",
|
|
36
36
|
"@lark-apaas/styled-jsx": "^1.0.1",
|
|
37
37
|
"@rspack/plugin-react-refresh": "^1.5.1",
|