@rsbuild/plugin-react 1.0.1-beta.8 → 1.0.1-rc.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/index.cjs CHANGED
@@ -100,14 +100,19 @@ var applyBasicReactSupport = (api, options) => {
100
100
  };
101
101
  var applyReactProfiler = (api) => {
102
102
  api.modifyEnvironmentConfig((config, { mergeEnvironmentConfig }) => {
103
+ if (config.mode !== "production") {
104
+ return;
105
+ }
103
106
  const enableProfilerConfig = {
104
107
  output: {
105
108
  minify: {
106
109
  jsOptions: {
107
- // Need to keep classnames and function names like Components for debugging purposes.
108
- mangle: {
109
- keep_classnames: true,
110
- keep_fnames: true
110
+ minimizerOptions: {
111
+ // Need to keep classnames and function names like Components for debugging purposes.
112
+ mangle: {
113
+ keep_classnames: true,
114
+ keep_fnames: true
115
+ }
111
116
  }
112
117
  }
113
118
  }
@@ -115,7 +120,10 @@ var applyReactProfiler = (api) => {
115
120
  };
116
121
  return mergeEnvironmentConfig(config, enableProfilerConfig);
117
122
  });
118
- api.modifyBundlerChain((chain) => {
123
+ api.modifyBundlerChain((chain, { isProd }) => {
124
+ if (!isProd) {
125
+ return;
126
+ }
119
127
  chain.resolve.alias.set("react-dom$", "react-dom/profiling");
120
128
  chain.resolve.alias.set("scheduler/tracing", "scheduler/tracing-profiling");
121
129
  });
@@ -174,8 +182,7 @@ var pluginReact = ({
174
182
  setup(api) {
175
183
  if (api.context.bundlerType === "rspack") {
176
184
  applyBasicReactSupport(api, options);
177
- const isProdProfile = enableProfiler && process.env.NODE_ENV === "production";
178
- if (isProdProfile) {
185
+ if (enableProfiler) {
179
186
  applyReactProfiler(api);
180
187
  }
181
188
  }
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.56.2_typescript@5.5.2/node_modules/@modern-js/module-tools/shims/esm.js
12
+ // ../../node_modules/.pnpm/@modern-js+module-tools@2.58.2_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
 
@@ -78,14 +78,19 @@ var applyBasicReactSupport = (api, options) => {
78
78
  };
79
79
  var applyReactProfiler = (api) => {
80
80
  api.modifyEnvironmentConfig((config, { mergeEnvironmentConfig }) => {
81
+ if (config.mode !== "production") {
82
+ return;
83
+ }
81
84
  const enableProfilerConfig = {
82
85
  output: {
83
86
  minify: {
84
87
  jsOptions: {
85
- // Need to keep classnames and function names like Components for debugging purposes.
86
- mangle: {
87
- keep_classnames: true,
88
- keep_fnames: true
88
+ minimizerOptions: {
89
+ // Need to keep classnames and function names like Components for debugging purposes.
90
+ mangle: {
91
+ keep_classnames: true,
92
+ keep_fnames: true
93
+ }
89
94
  }
90
95
  }
91
96
  }
@@ -93,7 +98,10 @@ var applyReactProfiler = (api) => {
93
98
  };
94
99
  return mergeEnvironmentConfig(config, enableProfilerConfig);
95
100
  });
96
- api.modifyBundlerChain((chain) => {
101
+ api.modifyBundlerChain((chain, { isProd }) => {
102
+ if (!isProd) {
103
+ return;
104
+ }
97
105
  chain.resolve.alias.set("react-dom$", "react-dom/profiling");
98
106
  chain.resolve.alias.set("scheduler/tracing", "scheduler/tracing-profiling");
99
107
  });
@@ -152,8 +160,7 @@ var pluginReact = ({
152
160
  setup(api) {
153
161
  if (api.context.bundlerType === "rspack") {
154
162
  applyBasicReactSupport(api, options);
155
- const isProdProfile = enableProfiler && process.env.NODE_ENV === "production";
156
- if (isProdProfile) {
163
+ if (enableProfiler) {
157
164
  applyReactProfiler(api);
158
165
  }
159
166
  }
@@ -0,0 +1 @@
1
+ {"//":"This file is for making TypeScript work with moduleResolution node16+.","version":"1.0.0"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/plugin-react",
3
- "version": "1.0.1-beta.8",
3
+ "version": "1.0.1-rc.0",
4
4
  "description": "React plugin for Rsbuild",
5
5
  "repository": {
6
6
  "type": "git",
@@ -11,28 +11,29 @@
11
11
  "type": "module",
12
12
  "exports": {
13
13
  ".": {
14
- "types": "./dist/index.d.ts",
14
+ "types": "./dist-types/index.d.ts",
15
15
  "import": "./dist/index.js",
16
16
  "require": "./dist/index.cjs"
17
17
  }
18
18
  },
19
19
  "main": "./dist/index.cjs",
20
- "types": "./dist/index.d.ts",
20
+ "types": "./dist-types/index.d.ts",
21
21
  "files": [
22
- "dist"
22
+ "dist",
23
+ "dist-types"
23
24
  ],
24
25
  "dependencies": {
25
- "@rspack/plugin-react-refresh": "1.0.0-beta.1",
26
+ "@rspack/plugin-react-refresh": "1.0.0",
26
27
  "react-refresh": "^0.14.2"
27
28
  },
28
29
  "devDependencies": {
29
30
  "@types/node": "18.x",
30
31
  "typescript": "^5.5.2",
31
- "@rsbuild/core": "1.0.1-beta.8",
32
- "@scripts/test-helper": "1.0.1-beta.8"
32
+ "@rsbuild/core": "1.0.1-rc.0",
33
+ "@scripts/test-helper": "1.0.1-rc.0"
33
34
  },
34
35
  "peerDependencies": {
35
- "@rsbuild/core": "^1.0.1-beta.8"
36
+ "@rsbuild/core": "^1.0.1-rc.0"
36
37
  },
37
38
  "publishConfig": {
38
39
  "access": "public",
File without changes
File without changes
File without changes