@rsbuild/plugin-react 1.0.0-alpha.3 → 1.0.0-alpha.5

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.cjs CHANGED
@@ -127,7 +127,7 @@ var applySplitChunksRule = (api, options = {
127
127
  react: true,
128
128
  router: true
129
129
  }) => {
130
- api.modifyBundlerChain((chain, { environment }) => {
130
+ api.modifyBundlerChain((chain, { environment, isProd }) => {
131
131
  const { config } = environment;
132
132
  if (config.performance.chunkSplit.strategy !== "split-by-experience") {
133
133
  return;
@@ -138,17 +138,16 @@ var applySplitChunksRule = (api, options = {
138
138
  }
139
139
  const extraGroups = {};
140
140
  if (options.react) {
141
- const isProd = process.env.NODE_ENV === "production";
142
141
  extraGroups.react = {
143
142
  name: "lib-react",
144
- test: isProd ? /[\\/]node_modules[\\/](?:react|react-dom|scheduler)[\\/]/ : /[\\/]node_modules[\\/](?:react|react-dom|scheduler|react-refresh|@rspack[\\/]plugin-react-refresh)[\\/]/,
143
+ test: isProd ? /node_modules[\\/](?:react|react-dom|scheduler)[\\/]/ : /node_modules[\\/](?:react|react-dom|scheduler|react-refresh|@rspack[\\/]plugin-react-refresh)[\\/]/,
145
144
  priority: 0
146
145
  };
147
146
  }
148
147
  if (options.router) {
149
148
  extraGroups.router = {
150
149
  name: "lib-router",
151
- test: /[\\/]node_modules[\\/](?:react-router|react-router-dom|history|@remix-run[\\/]router)[\\/]/,
150
+ test: /node_modules[\\/](?:react-router|react-router-dom|history|@remix-run[\\/]router)[\\/]/,
152
151
  priority: 0
153
152
  };
154
153
  }
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
9
9
  throw Error('Dynamic require of "' + x + '" is not supported');
10
10
  });
11
11
 
12
- // ../../node_modules/.pnpm/@modern-js+module-tools@2.54.5_eslint@9.6.0_typescript@5.5.2/node_modules/@modern-js/module-tools/shims/esm.js
12
+ // ../../node_modules/.pnpm/@modern-js+module-tools@2.54.6_eslint@9.6.0_typescript@5.5.2/node_modules/@modern-js/module-tools/shims/esm.js
13
13
  import { fileURLToPath } from "url";
14
14
  import path from "path";
15
15
 
@@ -105,7 +105,7 @@ var applySplitChunksRule = (api, options = {
105
105
  react: true,
106
106
  router: true
107
107
  }) => {
108
- api.modifyBundlerChain((chain, { environment }) => {
108
+ api.modifyBundlerChain((chain, { environment, isProd }) => {
109
109
  const { config } = environment;
110
110
  if (config.performance.chunkSplit.strategy !== "split-by-experience") {
111
111
  return;
@@ -116,17 +116,16 @@ var applySplitChunksRule = (api, options = {
116
116
  }
117
117
  const extraGroups = {};
118
118
  if (options.react) {
119
- const isProd = process.env.NODE_ENV === "production";
120
119
  extraGroups.react = {
121
120
  name: "lib-react",
122
- test: isProd ? /[\\/]node_modules[\\/](?:react|react-dom|scheduler)[\\/]/ : /[\\/]node_modules[\\/](?:react|react-dom|scheduler|react-refresh|@rspack[\\/]plugin-react-refresh)[\\/]/,
121
+ test: isProd ? /node_modules[\\/](?:react|react-dom|scheduler)[\\/]/ : /node_modules[\\/](?:react|react-dom|scheduler|react-refresh|@rspack[\\/]plugin-react-refresh)[\\/]/,
123
122
  priority: 0
124
123
  };
125
124
  }
126
125
  if (options.router) {
127
126
  extraGroups.router = {
128
127
  name: "lib-router",
129
- test: /[\\/]node_modules[\\/](?:react-router|react-router-dom|history|@remix-run[\\/]router)[\\/]/,
128
+ test: /node_modules[\\/](?:react-router|react-router-dom|history|@remix-run[\\/]router)[\\/]/,
130
129
  priority: 0
131
130
  };
132
131
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/plugin-react",
3
- "version": "1.0.0-alpha.3",
3
+ "version": "1.0.0-alpha.5",
4
4
  "description": "React plugin for Rsbuild",
5
5
  "repository": {
6
6
  "type": "git",
@@ -22,17 +22,17 @@
22
22
  "dist"
23
23
  ],
24
24
  "dependencies": {
25
- "@rspack/plugin-react-refresh": "1.0.0-alpha.0",
25
+ "@rspack/plugin-react-refresh": "1.0.0-alpha.1",
26
26
  "react-refresh": "^0.14.2"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@types/node": "18.x",
30
30
  "typescript": "^5.5.2",
31
- "@rsbuild/core": "1.0.0-alpha.3",
32
- "@scripts/test-helper": "1.0.0-alpha.3"
31
+ "@rsbuild/core": "1.0.0-alpha.5",
32
+ "@scripts/test-helper": "1.0.0-alpha.5"
33
33
  },
34
34
  "peerDependencies": {
35
- "@rsbuild/core": "^1.0.0-alpha.3"
35
+ "@rsbuild/core": "^1.0.0-alpha.5"
36
36
  },
37
37
  "publishConfig": {
38
38
  "access": "public",