@rsbuild/plugin-react 0.1.1 → 0.1.3
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/index.js +9 -11
- package/dist/index.mjs +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -50,16 +50,15 @@ var getAntdMajorVersion = (appDirectory) => {
|
|
|
50
50
|
};
|
|
51
51
|
var applyAntdSupport = (api) => {
|
|
52
52
|
api.modifyRsbuildConfig((rsbuildConfig) => {
|
|
53
|
-
|
|
54
|
-
(
|
|
55
|
-
if (rsbuildConfig.source.transformImport === false || ((_b = rsbuildConfig.source.transformImport) == null ? void 0 : _b.some(
|
|
53
|
+
rsbuildConfig.source ?? (rsbuildConfig.source = {});
|
|
54
|
+
if (rsbuildConfig.source.transformImport === false || rsbuildConfig.source.transformImport?.some(
|
|
56
55
|
(item) => item.libraryName === "antd"
|
|
57
|
-
))
|
|
56
|
+
)) {
|
|
58
57
|
return;
|
|
59
58
|
}
|
|
60
59
|
const antdMajorVersion = getAntdMajorVersion(api.context.rootPath);
|
|
61
60
|
if (antdMajorVersion && antdMajorVersion < 5) {
|
|
62
|
-
|
|
61
|
+
rsbuildConfig.source ?? (rsbuildConfig.source = {});
|
|
63
62
|
rsbuildConfig.source.transformImport = [
|
|
64
63
|
...rsbuildConfig.source.transformImport || [],
|
|
65
64
|
{
|
|
@@ -83,7 +82,7 @@ var applyArcoSupport = (api) => {
|
|
|
83
82
|
return;
|
|
84
83
|
}
|
|
85
84
|
const isUseSSR = (0, import_shared2.isServerTarget)(api.context.target);
|
|
86
|
-
if (!
|
|
85
|
+
if (!transformImport?.some((item) => item.libraryName === ARCO_NAME)) {
|
|
87
86
|
transformImport.push({
|
|
88
87
|
libraryName: ARCO_NAME,
|
|
89
88
|
libraryDirectory: isUseSSR ? "lib" : "es",
|
|
@@ -91,7 +90,7 @@ var applyArcoSupport = (api) => {
|
|
|
91
90
|
style: true
|
|
92
91
|
});
|
|
93
92
|
}
|
|
94
|
-
if (!
|
|
93
|
+
if (!transformImport?.some((item) => item.libraryName === ARCO_ICON)) {
|
|
95
94
|
transformImport.push({
|
|
96
95
|
libraryName: ARCO_ICON,
|
|
97
96
|
libraryDirectory: isUseSSR ? "react-icon-cjs" : "react-icon",
|
|
@@ -109,7 +108,7 @@ var applySplitChunksRule = (api) => {
|
|
|
109
108
|
api.modifyBundlerChain((chain) => {
|
|
110
109
|
const config = api.getNormalizedConfig();
|
|
111
110
|
const { chunkSplit } = config.performance || {};
|
|
112
|
-
if (
|
|
111
|
+
if (chunkSplit?.strategy !== "split-by-experience") {
|
|
113
112
|
return;
|
|
114
113
|
}
|
|
115
114
|
const currentConfig = chain.optimization.splitChunks.values();
|
|
@@ -143,9 +142,8 @@ var applySplitChunksRule = (api) => {
|
|
|
143
142
|
// src/react.ts
|
|
144
143
|
var import_shared4 = require("@rsbuild/shared");
|
|
145
144
|
function getReactRefreshEntry(compiler) {
|
|
146
|
-
|
|
147
|
-
const
|
|
148
|
-
const refresh = (_e = (_d = (_c = compiler.options.builtins) == null ? void 0 : _c.react) == null ? void 0 : _d.refresh) != null ? _e : true;
|
|
145
|
+
const hot = compiler.options.devServer?.hot ?? true;
|
|
146
|
+
const refresh = compiler.options.builtins?.react?.refresh ?? true;
|
|
149
147
|
if (hot && refresh) {
|
|
150
148
|
const reactRefreshEntryPath = require.resolve("@rspack/plugin-react-refresh/react-refresh-entry");
|
|
151
149
|
return reactRefreshEntryPath;
|
package/dist/index.mjs
CHANGED
|
@@ -10,7 +10,7 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
10
10
|
import { fileURLToPath } from "url";
|
|
11
11
|
import path from "path";
|
|
12
12
|
|
|
13
|
-
// ../../scripts/
|
|
13
|
+
// ../../scripts/requireShims.js
|
|
14
14
|
import { createRequire } from "module";
|
|
15
15
|
global.require = createRequire(import.meta.url);
|
|
16
16
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/plugin-react",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "React plugin for Rsbuild",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -24,14 +24,14 @@
|
|
|
24
24
|
"@rspack/plugin-react-refresh": "0.4.0",
|
|
25
25
|
"react-refresh": "^0.14.0",
|
|
26
26
|
"semver": "^7.5.4",
|
|
27
|
-
"@rsbuild/shared": "0.1.
|
|
27
|
+
"@rsbuild/shared": "0.1.3"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@types/node": "^16",
|
|
31
31
|
"@types/semver": "^7.5.4",
|
|
32
32
|
"typescript": "^5.3.0",
|
|
33
|
-
"@rsbuild/core": "0.1.
|
|
34
|
-
"@rsbuild/test-helper": "0.1.
|
|
33
|
+
"@rsbuild/core": "0.1.3",
|
|
34
|
+
"@rsbuild/test-helper": "0.1.3"
|
|
35
35
|
},
|
|
36
36
|
"publishConfig": {
|
|
37
37
|
"access": "public",
|