@vitejs/plugin-react 1.1.0-beta.1 → 1.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/CHANGELOG.md CHANGED
@@ -1,3 +1,29 @@
1
+ ## [1.1.3](https://github.com/vitejs/vite/compare/plugin-react@1.1.2...plugin-react@1.1.3) (2021-12-13)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **plugin-react:** only detect preamble in hmr context ([#6096](https://github.com/vitejs/vite/issues/6096)) ([8735294](https://github.com/vitejs/vite/commit/8735294055ce16308a6b8302eba4538f4a2931d0))
7
+
8
+
9
+
10
+ ## [1.1.2](https://github.com/vitejs/vite/compare/plugin-react@1.1.1...plugin-react@1.1.2) (2021-12-13)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * ignore babel config when running restore-jsx ([#6047](https://github.com/vitejs/vite/issues/6047)) ([9c2843c](https://github.com/vitejs/vite/commit/9c2843cf0506844ee32f042a04c22c440434df2a))
16
+
17
+
18
+
19
+ ## [1.1.1](https://github.com/vitejs/vite/compare/plugin-react@1.1.0...plugin-react@1.1.1) (2021-12-07)
20
+
21
+
22
+
23
+ # [1.1.0](https://github.com/vitejs/vite/compare/plugin-react@1.1.0-beta.1...plugin-react@1.1.0) (2021-11-22)
24
+
25
+
26
+
1
27
  # [1.1.0-beta.1](https://github.com/vitejs/vite/compare/plugin-react@1.1.0-beta.0...plugin-react@1.1.0-beta.1) (2021-11-19)
2
28
 
3
29
 
package/dist/index.js CHANGED
@@ -207,14 +207,14 @@ import RefreshRuntime from "${runtimePublicPath}";
207
207
  let prevRefreshReg;
208
208
  let prevRefreshSig;
209
209
 
210
- if (!window.__vite_plugin_react_preamble_installed__) {
211
- throw new Error(
212
- "@vitejs/plugin-react can't detect preamble. Something is wrong. " +
213
- "See https://github.com/vitejs/vite-plugin-react/pull/11#discussion_r430879201"
214
- );
215
- }
216
-
217
210
  if (import.meta.hot) {
211
+ if (!window.__vite_plugin_react_preamble_installed__) {
212
+ throw new Error(
213
+ "@vitejs/plugin-react can't detect preamble. Something is wrong. " +
214
+ "See https://github.com/vitejs/vite-plugin-react/pull/11#discussion_r430879201"
215
+ );
216
+ }
217
+
218
218
  prevRefreshReg = window.$RefreshReg$;
219
219
  prevRefreshSig = window.$RefreshSig$;
220
220
  window.$RefreshReg$ = (type, id) => {
@@ -304,6 +304,8 @@ async function restoreJSX(babel2, code, filename) {
304
304
  code = code.replace(/createElement\(Fragment,/g, "createElement(React.Fragment,");
305
305
  babelRestoreJSX || (babelRestoreJSX = Promise.resolve().then(() => (init_babel_restore_jsx(), babel_restore_jsx_exports)));
306
306
  const result = await babel2.transformAsync(code, {
307
+ babelrc: false,
308
+ configFile: false,
307
309
  ast: true,
308
310
  code: false,
309
311
  filename,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitejs/plugin-react",
3
- "version": "1.1.0-beta.1",
3
+ "version": "1.1.3",
4
4
  "license": "MIT",
5
5
  "author": "Evan You",
6
6
  "contributors": [
@@ -18,7 +18,7 @@
18
18
  "build-bundle": "esbuild src/index.ts --bundle --platform=node --target=node12 --external:@babel/* --external:@rollup/* --external:resolve --external:react-refresh/* --outfile=dist/index.js",
19
19
  "build-types": "tsc -p . --emitDeclarationOnly --outDir temp && api-extractor run && rimraf temp",
20
20
  "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s --commit-path . --lerna-package plugin-react",
21
- "release": "node ../../scripts/release.js"
21
+ "release": "node ../../scripts/release.cjs"
22
22
  },
23
23
  "engines": {
24
24
  "node": ">=12.0.0"
@@ -35,14 +35,14 @@ import RefreshRuntime from "${runtimePublicPath}";
35
35
  let prevRefreshReg;
36
36
  let prevRefreshSig;
37
37
 
38
- if (!window.__vite_plugin_react_preamble_installed__) {
39
- throw new Error(
40
- "@vitejs/plugin-react can't detect preamble. Something is wrong. " +
41
- "See https://github.com/vitejs/vite-plugin-react/pull/11#discussion_r430879201"
42
- );
43
- }
44
-
45
38
  if (import.meta.hot) {
39
+ if (!window.__vite_plugin_react_preamble_installed__) {
40
+ throw new Error(
41
+ "@vitejs/plugin-react can't detect preamble. Something is wrong. " +
42
+ "See https://github.com/vitejs/vite-plugin-react/pull/11#discussion_r430879201"
43
+ );
44
+ }
45
+
46
46
  prevRefreshReg = window.$RefreshReg$;
47
47
  prevRefreshSig = window.$RefreshSig$;
48
48
  window.$RefreshReg$ = (type, id) => {
@@ -48,6 +48,8 @@ export async function restoreJSX(
48
48
  babelRestoreJSX ||= import('./babel-restore-jsx')
49
49
 
50
50
  const result = await babel.transformAsync(code, {
51
+ babelrc: false,
52
+ configFile: false,
51
53
  ast: true,
52
54
  code: false,
53
55
  filename,