@rsbuild/plugin-react 0.0.0-next-20231220091832 → 0.0.0-next-20240104101129

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.d.ts CHANGED
@@ -3,10 +3,23 @@ import { RsbuildPlugin } from '@rsbuild/core';
3
3
  declare const isBeyondReact17: (cwd: string) => Promise<any>;
4
4
 
5
5
  type SplitReactChunkOptions = {
6
+ /**
7
+ * Whether to enable split chunking for React-related dependencies (e.g., react, react-dom, scheduler).
8
+ *
9
+ * @default true
10
+ */
6
11
  react?: boolean;
12
+ /**
13
+ * Whether to enable split chunking for routing-related dependencies (e.g., react-router, react-router-dom, history).
14
+ *
15
+ * @default true
16
+ */
7
17
  router?: boolean;
8
18
  };
9
19
  type PluginReactOptions = {
20
+ /**
21
+ * Configuration for chunk splitting of React-related dependencies.
22
+ */
10
23
  splitChunks?: SplitReactChunkOptions;
11
24
  };
12
25
  declare const pluginReact: (options?: PluginReactOptions) => RsbuildPlugin;
package/dist/index.js CHANGED
@@ -166,12 +166,9 @@ var setupCompiler = (compiler) => {
166
166
  if (!reactRefreshEntry) {
167
167
  return;
168
168
  }
169
- for (const key in compiler.options.entry) {
170
- compiler.options.entry[key].import = [
171
- reactRefreshEntry,
172
- ...compiler.options.entry[key].import || []
173
- ];
174
- }
169
+ new compiler.webpack.EntryPlugin(compiler.context, reactRefreshEntry, {
170
+ name: void 0
171
+ }).apply(compiler);
175
172
  };
176
173
  var applyBasicReactSupport = (api) => {
177
174
  api.onAfterCreateCompiler(({ compiler: multiCompiler }) => {
package/dist/index.mjs CHANGED
@@ -6,7 +6,7 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
6
6
  throw Error('Dynamic require of "' + x + '" is not supported');
7
7
  });
8
8
 
9
- // ../../node_modules/.pnpm/@modern-js+module-tools@2.41.0_typescript@5.3.2/node_modules/@modern-js/module-tools/shims/esm.js
9
+ // ../../node_modules/.pnpm/@modern-js+module-tools@2.45.0_typescript@5.3.2/node_modules/@modern-js/module-tools/shims/esm.js
10
10
  import { fileURLToPath } from "url";
11
11
  import path from "path";
12
12
 
@@ -154,12 +154,9 @@ var setupCompiler = (compiler) => {
154
154
  if (!reactRefreshEntry) {
155
155
  return;
156
156
  }
157
- for (const key in compiler.options.entry) {
158
- compiler.options.entry[key].import = [
159
- reactRefreshEntry,
160
- ...compiler.options.entry[key].import || []
161
- ];
162
- }
157
+ new compiler.webpack.EntryPlugin(compiler.context, reactRefreshEntry, {
158
+ name: void 0
159
+ }).apply(compiler);
163
160
  };
164
161
  var applyBasicReactSupport = (api) => {
165
162
  api.onAfterCreateCompiler(({ compiler: multiCompiler }) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/plugin-react",
3
- "version": "0.0.0-next-20231220091832",
3
+ "version": "0.0.0-next-20240104101129",
4
4
  "description": "React plugin for Rsbuild",
5
5
  "repository": {
6
6
  "type": "git",
@@ -22,15 +22,15 @@
22
22
  "dist"
23
23
  ],
24
24
  "dependencies": {
25
- "@rspack/plugin-react-refresh": "0.4.3",
25
+ "@rspack/plugin-react-refresh": "0.4.5",
26
26
  "react-refresh": "^0.14.0",
27
- "@rsbuild/shared": "0.0.0-next-20231220091832"
27
+ "@rsbuild/shared": "0.0.0-next-20240104101129"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@types/node": "16.x",
31
31
  "typescript": "^5.3.0",
32
- "@rsbuild/core": "0.0.0-next-20231220091832",
33
- "@rsbuild/test-helper": "0.0.0-next-20231220091832"
32
+ "@rsbuild/core": "0.0.0-next-20240104101129",
33
+ "@rsbuild/test-helper": "0.0.0-next-20240104101129"
34
34
  },
35
35
  "publishConfig": {
36
36
  "access": "public",