@modern-js/uni-builder 2.69.7 → 2.70.0
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/dist/rspack/index.js
CHANGED
|
@@ -36,6 +36,7 @@ var import_core = require("@rsbuild/core");
|
|
|
36
36
|
var import_compatLegacyPlugin = require("../shared/compatLegacyPlugin");
|
|
37
37
|
var import_parseCommonConfig = require("../shared/parseCommonConfig");
|
|
38
38
|
var import_rsbuild_rsc_plugin = require("../shared/rsc/plugins/rsbuild-rsc-plugin");
|
|
39
|
+
var import_rscExternalFallback = require("../shared/rsc/rscExternalFallback");
|
|
39
40
|
var import_utils = require("../shared/utils");
|
|
40
41
|
async function parseConfig(uniBuilderConfig, options) {
|
|
41
42
|
var _uniBuilderConfig_experiments, _uniBuilderConfig_tools, _uniBuilderConfig_tools1, _uniBuilderConfig_server;
|
|
@@ -139,6 +140,8 @@ async function parseConfig(uniBuilderConfig, options) {
|
|
|
139
140
|
rscServerRuntimePath,
|
|
140
141
|
internalDirectory
|
|
141
142
|
}));
|
|
143
|
+
} else {
|
|
144
|
+
(0, import_rscExternalFallback.addRscExternalFallback)(rsbuildConfig, rsbuildPlugins);
|
|
142
145
|
}
|
|
143
146
|
return {
|
|
144
147
|
rsbuildConfig,
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { RsbuildConfig, RsbuildPlugin } from '@rsbuild/core';
|
|
2
|
+
/**
|
|
3
|
+
* Add RSC external fallback when RSC is disabled.
|
|
4
|
+
* When RSC is disabled, provide an empty fallback for react-server-dom-webpack
|
|
5
|
+
* to avoid build errors while still allowing projects that may have conditional imports.
|
|
6
|
+
*/
|
|
7
|
+
export declare function addRscExternalFallback(rsbuildConfig: RsbuildConfig, rsbuildPlugins: RsbuildPlugin[]): void;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var rscExternalFallback_exports = {};
|
|
20
|
+
__export(rscExternalFallback_exports, {
|
|
21
|
+
addRscExternalFallback: () => addRscExternalFallback
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(rscExternalFallback_exports);
|
|
24
|
+
function addRscExternalFallback(rsbuildConfig, rsbuildPlugins) {
|
|
25
|
+
var _rsbuildConfig_output;
|
|
26
|
+
var _rsbuildConfig, _rsbuildConfig1, _rsbuildConfig_source;
|
|
27
|
+
const existingExternals = (_rsbuildConfig_output = rsbuildConfig.output) === null || _rsbuildConfig_output === void 0 ? void 0 : _rsbuildConfig_output.externals;
|
|
28
|
+
var _output;
|
|
29
|
+
(_output = (_rsbuildConfig = rsbuildConfig).output) !== null && _output !== void 0 ? _output : _rsbuildConfig.output = {};
|
|
30
|
+
const externalsArray = Array.isArray(existingExternals) ? existingExternals : existingExternals ? [
|
|
31
|
+
existingExternals
|
|
32
|
+
] : [];
|
|
33
|
+
rsbuildConfig.output.externals = [
|
|
34
|
+
...externalsArray,
|
|
35
|
+
{
|
|
36
|
+
"react-server-dom-webpack": "__REACT_SERVER_DOM_WEBPACK_EMPTY__"
|
|
37
|
+
}
|
|
38
|
+
];
|
|
39
|
+
var _source;
|
|
40
|
+
(_source = (_rsbuildConfig1 = rsbuildConfig).source) !== null && _source !== void 0 ? _source : _rsbuildConfig1.source = {};
|
|
41
|
+
var _define;
|
|
42
|
+
(_define = (_rsbuildConfig_source = rsbuildConfig.source).define) !== null && _define !== void 0 ? _define : _rsbuildConfig_source.define = {};
|
|
43
|
+
if (!("__REACT_SERVER_DOM_WEBPACK_EMPTY__" in rsbuildConfig.source.define)) {
|
|
44
|
+
rsbuildConfig.source.define.__REACT_SERVER_DOM_WEBPACK_EMPTY__ = "{}";
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
48
|
+
0 && (module.exports = {
|
|
49
|
+
addRscExternalFallback
|
|
50
|
+
});
|
package/dist/webpack/index.js
CHANGED
|
@@ -37,6 +37,7 @@ var import_compatLegacyPlugin = require("../shared/compatLegacyPlugin");
|
|
|
37
37
|
var import_parseCommonConfig = require("../shared/parseCommonConfig");
|
|
38
38
|
var import_postcss = require("../shared/plugins/postcss");
|
|
39
39
|
var import_rsbuild_rsc_plugin = require("../shared/rsc/plugins/rsbuild-rsc-plugin");
|
|
40
|
+
var import_rscExternalFallback = require("../shared/rsc/rscExternalFallback");
|
|
40
41
|
var import_utils = require("../shared/utils");
|
|
41
42
|
var import_babel = require("./plugins/babel");
|
|
42
43
|
var import_include = require("./plugins/include");
|
|
@@ -109,6 +110,8 @@ async function parseConfig(uniBuilderConfig, options) {
|
|
|
109
110
|
rscServerRuntimePath,
|
|
110
111
|
internalDirectory
|
|
111
112
|
}));
|
|
113
|
+
} else {
|
|
114
|
+
(0, import_rscExternalFallback.addRscExternalFallback)(rsbuildConfig, rsbuildPlugins);
|
|
112
115
|
}
|
|
113
116
|
if ((_uniBuilderConfig_tools1 = uniBuilderConfig.tools) === null || _uniBuilderConfig_tools1 === void 0 ? void 0 : _uniBuilderConfig_tools1.tsLoader) {
|
|
114
117
|
const { pluginTsLoader } = await Promise.resolve().then(() => __toESM(require("./plugins/tsLoader")));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@modern-js/uni-builder",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.70.0",
|
|
4
4
|
"description": "Unified builder for Modern.js",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"@babel/preset-react": "^7.22.15",
|
|
41
41
|
"@babel/types": "^7.26.0",
|
|
42
42
|
"@pmmmwh/react-refresh-webpack-plugin": "0.5.16",
|
|
43
|
-
"@rsbuild/core": "1.7.
|
|
43
|
+
"@rsbuild/core": "1.7.2",
|
|
44
44
|
"@rsbuild/plugin-assets-retry": "1.5.0",
|
|
45
45
|
"@rsbuild/plugin-babel": "1.0.6",
|
|
46
46
|
"@rsbuild/plugin-check-syntax": "1.6.0",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"@rsbuild/webpack": "1.6.1",
|
|
61
61
|
"@swc/core": "1.15.8",
|
|
62
62
|
"@swc/helpers": "^0.5.17",
|
|
63
|
-
"autoprefixer": "10.4.
|
|
63
|
+
"autoprefixer": "10.4.23",
|
|
64
64
|
"babel-loader": "9.2.1",
|
|
65
65
|
"babel-plugin-import": "1.13.8",
|
|
66
66
|
"babel-plugin-styled-components": "1.13.3",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"es-module-lexer": "^1.1.0",
|
|
71
71
|
"glob": "^9.3.5",
|
|
72
72
|
"html-minifier-terser": "^7.2.0",
|
|
73
|
-
"html-webpack-plugin": "5.6.
|
|
73
|
+
"html-webpack-plugin": "5.6.5",
|
|
74
74
|
"jiti": "1.21.7",
|
|
75
75
|
"lodash": "^4.17.21",
|
|
76
76
|
"magic-string": "0.30.17",
|
|
@@ -90,9 +90,9 @@
|
|
|
90
90
|
"ts-loader": "9.4.4",
|
|
91
91
|
"webpack": "^5.103.0",
|
|
92
92
|
"webpack-subresource-integrity": "5.1.0",
|
|
93
|
-
"@modern-js/babel-preset": "2.
|
|
94
|
-
"@modern-js/flight-server-transform-plugin": "2.
|
|
95
|
-
"@modern-js/utils": "2.
|
|
93
|
+
"@modern-js/babel-preset": "2.70.0",
|
|
94
|
+
"@modern-js/flight-server-transform-plugin": "2.70.0",
|
|
95
|
+
"@modern-js/utils": "2.70.0"
|
|
96
96
|
},
|
|
97
97
|
"devDependencies": {
|
|
98
98
|
"@rsbuild/plugin-webpack-swc": "1.1.2",
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
"react-dom": "^18.2.0",
|
|
104
104
|
"terser": "^5.31.1",
|
|
105
105
|
"typescript": "^5.3.0",
|
|
106
|
-
"@modern-js/types": "2.
|
|
106
|
+
"@modern-js/types": "2.70.0",
|
|
107
107
|
"@scripts/build": "2.66.0",
|
|
108
108
|
"@scripts/vitest-config": "2.66.0"
|
|
109
109
|
},
|