@vitejs/plugin-react 1.2.0 → 1.3.2
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/README.md +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.js +34 -32
- package/package.json +6 -7
- package/src/fast-refresh.ts +7 -2
- package/src/index.ts +9 -2
- package/src/jsx-runtime/restore-jsx.spec.ts +55 -0
- package/src/jsx-runtime/restore-jsx.ts +26 -16
- package/CHANGELOG.md +0 -141
package/README.md
CHANGED
package/dist/index.d.ts
CHANGED
@@ -23,6 +23,12 @@ export declare interface Options {
|
|
23
23
|
* @default "react"
|
24
24
|
*/
|
25
25
|
jsxImportSource?: string;
|
26
|
+
/**
|
27
|
+
* Set this to `true` to annotate the JSX factory with `\/* @__PURE__ *\/`.
|
28
|
+
* This option is ignored when `jsxRuntime` is not `"automatic"`.
|
29
|
+
* @default true
|
30
|
+
*/
|
31
|
+
jsxPure?: boolean;
|
26
32
|
/**
|
27
33
|
* Babel configuration applied in both dev and prod.
|
28
34
|
*/
|
package/dist/index.js
CHANGED
@@ -21,7 +21,6 @@ var __spreadValues = (a, b) => {
|
|
21
21
|
return a;
|
22
22
|
};
|
23
23
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
24
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
25
24
|
var __esm = (fn, res) => function __init() {
|
26
25
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
27
26
|
};
|
@@ -29,22 +28,16 @@ var __export = (target, all) => {
|
|
29
28
|
for (var name in all)
|
30
29
|
__defProp(target, name, { get: all[name], enumerable: true });
|
31
30
|
};
|
32
|
-
var
|
33
|
-
if (
|
34
|
-
for (let key of __getOwnPropNames(
|
35
|
-
if (!__hasOwnProp.call(
|
36
|
-
__defProp(
|
31
|
+
var __copyProps = (to, from, except, desc) => {
|
32
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
33
|
+
for (let key of __getOwnPropNames(from))
|
34
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
35
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
37
36
|
}
|
38
|
-
return
|
37
|
+
return to;
|
39
38
|
};
|
40
|
-
var __toESM = (
|
41
|
-
|
42
|
-
};
|
43
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
44
|
-
return (module2, temp) => {
|
45
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
46
|
-
};
|
47
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
39
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
40
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
48
41
|
|
49
42
|
// src/jsx-runtime/babel-restore-jsx.ts
|
50
43
|
var babel_restore_jsx_exports = {};
|
@@ -158,12 +151,12 @@ function babel_restore_jsx_default({ types: t }) {
|
|
158
151
|
const isPlainObjectExpression = (node) => t.isObjectExpression(node) && node.properties.every((property) => t.isSpreadElement(property) || t.isObjectProperty(property, { computed: false }) && getJSXIdentifier(property.key) != null && getJSXAttributeValue(property.value) != null);
|
159
152
|
return {
|
160
153
|
visitor: {
|
161
|
-
CallExpression(
|
162
|
-
const node = getJSXNode(
|
154
|
+
CallExpression(path2) {
|
155
|
+
const node = getJSXNode(path2.node);
|
163
156
|
if (node == null) {
|
164
157
|
return null;
|
165
158
|
}
|
166
|
-
|
159
|
+
path2.replaceWith(node);
|
167
160
|
}
|
168
161
|
}
|
169
162
|
};
|
@@ -178,14 +171,18 @@ var src_exports = {};
|
|
178
171
|
__export(src_exports, {
|
179
172
|
default: () => viteReact
|
180
173
|
});
|
174
|
+
module.exports = viteReact;
|
175
|
+
viteReact['default'] = viteReact;
|
181
176
|
var babel = __toESM(require("@babel/core"));
|
182
177
|
var import_pluginutils = require("@rollup/pluginutils");
|
183
178
|
var import_resolve = __toESM(require("resolve"));
|
184
179
|
|
185
180
|
// src/fast-refresh.ts
|
186
181
|
var import_fs = __toESM(require("fs"));
|
182
|
+
var import_path = __toESM(require("path"));
|
187
183
|
var runtimePublicPath = "/@react-refresh";
|
188
|
-
var
|
184
|
+
var reactRefreshDir = import_path.default.dirname(require.resolve("react-refresh/package.json"));
|
185
|
+
var runtimeFilePath = import_path.default.join(reactRefreshDir, "cjs/react-refresh-runtime.development.js");
|
189
186
|
var runtimeCode = `
|
190
187
|
const exports = {}
|
191
188
|
${import_fs.default.readFileSync(runtimeFilePath, "utf-8")}
|
@@ -273,10 +270,10 @@ function isComponentLikeName(name) {
|
|
273
270
|
function babelImportToRequire({ types: t }) {
|
274
271
|
return {
|
275
272
|
visitor: {
|
276
|
-
ImportDeclaration(
|
277
|
-
const decl =
|
273
|
+
ImportDeclaration(path2) {
|
274
|
+
const decl = path2.node;
|
278
275
|
const spec = decl.specifiers[0];
|
279
|
-
|
276
|
+
path2.replaceWith(t.variableDeclaration("var", [
|
280
277
|
t.variableDeclarator(spec.local, t.memberExpression(t.callExpression(t.identifier("require"), [decl.source]), spec.imported))
|
281
278
|
]));
|
282
279
|
}
|
@@ -295,16 +292,22 @@ async function restoreJSX(babel2, code, filename) {
|
|
295
292
|
if (!reactAlias) {
|
296
293
|
return jsxNotFound;
|
297
294
|
}
|
298
|
-
const reactJsxRE = new RegExp("\\b" + reactAlias + "\\.(createElement|Fragment)\\b", "g");
|
299
295
|
let hasCompiledJsx = false;
|
300
|
-
|
296
|
+
const fragmentPattern = `\\b${reactAlias}\\.Fragment\\b`;
|
297
|
+
const createElementPattern = `\\b${reactAlias}\\.createElement\\(\\s*([A-Z"'][\\w$.]*["']?)`;
|
298
|
+
code = code.replace(new RegExp(fragmentPattern, "g"), () => {
|
301
299
|
hasCompiledJsx = true;
|
302
|
-
return "React."
|
300
|
+
return "React.Fragment";
|
301
|
+
}).replace(new RegExp(createElementPattern, "g"), (original, component) => {
|
302
|
+
if (/^[a-z][\w$]*$/.test(component)) {
|
303
|
+
return original;
|
304
|
+
}
|
305
|
+
hasCompiledJsx = true;
|
306
|
+
return "React.createElement(" + (component === "Fragment" ? "React.Fragment" : component);
|
303
307
|
});
|
304
308
|
if (!hasCompiledJsx) {
|
305
309
|
return jsxNotFound;
|
306
310
|
}
|
307
|
-
code = code.replace(/createElement\(Fragment,/g, "createElement(React.Fragment,");
|
308
311
|
babelRestoreJSX || (babelRestoreJSX = Promise.resolve().then(() => (init_babel_restore_jsx(), babel_restore_jsx_exports)));
|
309
312
|
const result = await babel2.transformAsync(code, {
|
310
313
|
babelrc: false,
|
@@ -393,7 +396,7 @@ function viteReact(opts = {}) {
|
|
393
396
|
if (isReactModule && filter(id)) {
|
394
397
|
useFastRefresh = true;
|
395
398
|
plugins.push([
|
396
|
-
await loadPlugin("react-refresh/babel
|
399
|
+
await loadPlugin("react-refresh/babel"),
|
397
400
|
{ skipEnvCheck: true }
|
398
401
|
]);
|
399
402
|
}
|
@@ -407,7 +410,8 @@ function viteReact(opts = {}) {
|
|
407
410
|
await loadPlugin("@babel/plugin-transform-react-jsx" + (isProduction ? "" : "-development")),
|
408
411
|
{
|
409
412
|
runtime: "automatic",
|
410
|
-
importSource: opts.jsxImportSource
|
413
|
+
importSource: opts.jsxImportSource,
|
414
|
+
pure: opts.jsxPure !== false
|
411
415
|
}
|
412
416
|
]);
|
413
417
|
if (isCommonJS) {
|
@@ -533,11 +537,9 @@ function viteReact(opts = {}) {
|
|
533
537
|
return [viteBabel, viteReactRefresh, useAutomaticRuntime && viteReactJsx];
|
534
538
|
}
|
535
539
|
viteReact.preambleCode = preambleCode;
|
536
|
-
function loadPlugin(
|
537
|
-
return Promise.resolve().then(() => __toESM(require(
|
540
|
+
function loadPlugin(path2) {
|
541
|
+
return Promise.resolve().then(() => __toESM(require(path2))).then((module2) => module2.default || module2);
|
538
542
|
}
|
539
|
-
module.exports = viteReact;
|
540
|
-
viteReact['default'] = viteReact;
|
541
543
|
// Annotate the CommonJS export names for ESM import in node:
|
542
544
|
0 && (module.exports = {});
|
543
545
|
/**
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vitejs/plugin-react",
|
3
|
-
"version": "1.2
|
3
|
+
"version": "1.3.2",
|
4
4
|
"license": "MIT",
|
5
5
|
"author": "Evan You",
|
6
6
|
"contributors": [
|
@@ -18,8 +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 && npm run patch-dist",
|
19
19
|
"patch-dist": "ts-node ../../scripts/patchEsbuildDist.ts dist/index.js viteReact",
|
20
20
|
"build-types": "tsc -p . --emitDeclarationOnly --outDir temp && api-extractor run && rimraf temp",
|
21
|
-
"
|
22
|
-
"release": "ts-node ../../scripts/release.ts"
|
21
|
+
"prepublishOnly": "(cd ../vite && npm run build) && npm run build"
|
23
22
|
},
|
24
23
|
"engines": {
|
25
24
|
"node": ">=12.0.0"
|
@@ -34,13 +33,13 @@
|
|
34
33
|
},
|
35
34
|
"homepage": "https://github.com/vitejs/vite/tree/main/packages/plugin-react#readme",
|
36
35
|
"dependencies": {
|
37
|
-
"@babel/core": "^7.
|
38
|
-
"@babel/plugin-transform-react-jsx": "^7.
|
36
|
+
"@babel/core": "^7.17.10",
|
37
|
+
"@babel/plugin-transform-react-jsx": "^7.17.3",
|
39
38
|
"@babel/plugin-transform-react-jsx-development": "^7.16.7",
|
40
39
|
"@babel/plugin-transform-react-jsx-self": "^7.16.7",
|
41
40
|
"@babel/plugin-transform-react-jsx-source": "^7.16.7",
|
42
|
-
"@rollup/pluginutils": "^4.1
|
43
|
-
"react-refresh": "^0.
|
41
|
+
"@rollup/pluginutils": "^4.2.1",
|
42
|
+
"react-refresh": "^0.13.0",
|
44
43
|
"resolve": "^1.22.0"
|
45
44
|
}
|
46
45
|
}
|
package/src/fast-refresh.ts
CHANGED
@@ -1,10 +1,15 @@
|
|
1
1
|
import type { types as t } from '@babel/core'
|
2
2
|
import fs from 'fs'
|
3
|
+
import path from 'path'
|
3
4
|
|
4
5
|
export const runtimePublicPath = '/@react-refresh'
|
5
6
|
|
6
|
-
const
|
7
|
-
'react-refresh/
|
7
|
+
const reactRefreshDir = path.dirname(
|
8
|
+
require.resolve('react-refresh/package.json')
|
9
|
+
)
|
10
|
+
const runtimeFilePath = path.join(
|
11
|
+
reactRefreshDir,
|
12
|
+
'cjs/react-refresh-runtime.development.js'
|
8
13
|
)
|
9
14
|
|
10
15
|
export const runtimeCode = `
|
package/src/index.ts
CHANGED
@@ -32,6 +32,12 @@ export interface Options {
|
|
32
32
|
* @default "react"
|
33
33
|
*/
|
34
34
|
jsxImportSource?: string
|
35
|
+
/**
|
36
|
+
* Set this to `true` to annotate the JSX factory with `\/* @__PURE__ *\/`.
|
37
|
+
* This option is ignored when `jsxRuntime` is not `"automatic"`.
|
38
|
+
* @default true
|
39
|
+
*/
|
40
|
+
jsxPure?: boolean
|
35
41
|
|
36
42
|
/**
|
37
43
|
* Babel configuration applied in both dev and prod.
|
@@ -170,7 +176,7 @@ export default function viteReact(opts: Options = {}): PluginOption[] {
|
|
170
176
|
if (isReactModule && filter(id)) {
|
171
177
|
useFastRefresh = true
|
172
178
|
plugins.push([
|
173
|
-
await loadPlugin('react-refresh/babel
|
179
|
+
await loadPlugin('react-refresh/babel'),
|
174
180
|
{ skipEnvCheck: true }
|
175
181
|
])
|
176
182
|
}
|
@@ -195,7 +201,8 @@ export default function viteReact(opts: Options = {}): PluginOption[] {
|
|
195
201
|
),
|
196
202
|
{
|
197
203
|
runtime: 'automatic',
|
198
|
-
importSource: opts.jsxImportSource
|
204
|
+
importSource: opts.jsxImportSource,
|
205
|
+
pure: opts.jsxPure !== false
|
199
206
|
}
|
200
207
|
])
|
201
208
|
|
@@ -0,0 +1,55 @@
|
|
1
|
+
import { restoreJSX } from './restore-jsx'
|
2
|
+
import * as babel from '@babel/core'
|
3
|
+
|
4
|
+
async function jsx(sourceCode: string) {
|
5
|
+
const [ast] = await restoreJSX(babel, sourceCode, 'test.js')
|
6
|
+
if (ast === null) {
|
7
|
+
return ast
|
8
|
+
}
|
9
|
+
const { code } = await babel.transformFromAstAsync(ast, null, {
|
10
|
+
configFile: false
|
11
|
+
})
|
12
|
+
return code
|
13
|
+
}
|
14
|
+
// jsx(`import React__default, { PureComponent, Component, forwardRef, memo, createElement } from 'react';
|
15
|
+
// React__default.createElement(Foo)`)
|
16
|
+
// Tests adapted from: https://github.com/flying-sheep/babel-plugin-transform-react-createelement-to-jsx/blob/63137b6/test/index.js
|
17
|
+
describe('restore-jsx', () => {
|
18
|
+
it('should trans to ', async () => {
|
19
|
+
expect(
|
20
|
+
await jsx(`import React__default, { PureComponent, Component, forwardRef, memo, createElement } from 'react';
|
21
|
+
React__default.createElement(foo)`)
|
22
|
+
).toBeNull()
|
23
|
+
expect(
|
24
|
+
await jsx(`import React__default, { PureComponent, Component, forwardRef, memo, createElement } from 'react';
|
25
|
+
React__default.createElement("h1")`)
|
26
|
+
).toMatch(`<h1 />;`)
|
27
|
+
expect(
|
28
|
+
await jsx(`import React__default, { PureComponent, Component, forwardRef, memo, createElement } from 'react';
|
29
|
+
React__default.createElement(Foo)`)
|
30
|
+
).toMatch(`<Foo />;`)
|
31
|
+
expect(
|
32
|
+
await jsx(`import React__default, { PureComponent, Component, forwardRef, memo, createElement } from 'react';
|
33
|
+
React__default.createElement(Foo.Bar)`)
|
34
|
+
).toMatch(`<Foo.Bar />;`)
|
35
|
+
expect(
|
36
|
+
await jsx(`import React__default, { PureComponent, Component, forwardRef, memo, createElement } from 'react';
|
37
|
+
React__default.createElement(Foo.Bar.Baz)`)
|
38
|
+
).toMatch(`<Foo.Bar.Baz />;`)
|
39
|
+
})
|
40
|
+
|
41
|
+
it('should handle props', async () => {
|
42
|
+
expect(
|
43
|
+
await jsx(`import React__default, { PureComponent, Component, forwardRef, memo, createElement } from 'react';
|
44
|
+
React__default.createElement(foo, {hi: there})`)
|
45
|
+
).toBeNull()
|
46
|
+
expect(
|
47
|
+
await jsx(`import React__default, { PureComponent, Component, forwardRef, memo, createElement } from 'react';
|
48
|
+
React__default.createElement("h1", {hi: there})`)
|
49
|
+
).toMatch(`<h1 hi={there} />;`)
|
50
|
+
expect(
|
51
|
+
await jsx(`import React__default, { PureComponent, Component, forwardRef, memo, createElement } from 'react';
|
52
|
+
React__default.createElement(Foo, {hi: there})`)
|
53
|
+
).toMatch(`<Foo hi={there} />;`)
|
54
|
+
})
|
55
|
+
})
|
@@ -20,32 +20,42 @@ export async function restoreJSX(
|
|
20
20
|
}
|
21
21
|
|
22
22
|
const [reactAlias, isCommonJS] = parseReactAlias(code)
|
23
|
+
|
23
24
|
if (!reactAlias) {
|
24
25
|
return jsxNotFound
|
25
26
|
}
|
26
27
|
|
27
|
-
const reactJsxRE = new RegExp(
|
28
|
-
'\\b' + reactAlias + '\\.(createElement|Fragment)\\b',
|
29
|
-
'g'
|
30
|
-
)
|
31
|
-
|
32
28
|
let hasCompiledJsx = false
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
29
|
+
|
30
|
+
const fragmentPattern = `\\b${reactAlias}\\.Fragment\\b`
|
31
|
+
const createElementPattern = `\\b${reactAlias}\\.createElement\\(\\s*([A-Z"'][\\w$.]*["']?)`
|
32
|
+
|
33
|
+
// Replace the alias with "React" so JSX can be reverse compiled.
|
34
|
+
code = code
|
35
|
+
.replace(new RegExp(fragmentPattern, 'g'), () => {
|
36
|
+
hasCompiledJsx = true
|
37
|
+
return 'React.Fragment'
|
38
|
+
})
|
39
|
+
.replace(new RegExp(createElementPattern, 'g'), (original, component) => {
|
40
|
+
if (/^[a-z][\w$]*$/.test(component)) {
|
41
|
+
// Take care not to replace the alias for `createElement` calls whose
|
42
|
+
// component is a lowercased variable, since the `restoreJSX` Babel
|
43
|
+
// plugin leaves them untouched.
|
44
|
+
return original
|
45
|
+
}
|
46
|
+
hasCompiledJsx = true
|
47
|
+
return (
|
48
|
+
'React.createElement(' +
|
49
|
+
// Assume `Fragment` is equivalent to `React.Fragment` so modules
|
50
|
+
// that use `import {Fragment} from 'react'` are reverse compiled.
|
51
|
+
(component === 'Fragment' ? 'React.Fragment' : component)
|
52
|
+
)
|
53
|
+
})
|
38
54
|
|
39
55
|
if (!hasCompiledJsx) {
|
40
56
|
return jsxNotFound
|
41
57
|
}
|
42
58
|
|
43
|
-
// Support modules that use `import {Fragment} from 'react'`
|
44
|
-
code = code.replace(
|
45
|
-
/createElement\(Fragment,/g,
|
46
|
-
'createElement(React.Fragment,'
|
47
|
-
)
|
48
|
-
|
49
59
|
babelRestoreJSX ||= import('./babel-restore-jsx')
|
50
60
|
|
51
61
|
const result = await babel.transformAsync(code, {
|
package/CHANGELOG.md
DELETED
@@ -1,141 +0,0 @@
|
|
1
|
-
# [1.2.0](https://github.com/vitejs/vite/compare/plugin-react@1.1.4...plugin-react@1.2.0) (2022-02-09)
|
2
|
-
|
3
|
-
|
4
|
-
### Features
|
5
|
-
|
6
|
-
* **plugin-react:** ensure `overrides` array exists before `api.reactBabel` hooks are called ([#6750](https://github.com/vitejs/vite/issues/6750)) ([104bdb5](https://github.com/vitejs/vite/commit/104bdb5b5e44e79bf3456cabe15f3753f7c1ef28))
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
## [1.1.4](https://github.com/vitejs/vite/compare/plugin-react@1.1.3...plugin-react@1.1.4) (2022-01-04)
|
11
|
-
|
12
|
-
|
13
|
-
### Bug Fixes
|
14
|
-
|
15
|
-
* **plugin-react:** check for import React statement in .js files ([#6320](https://github.com/vitejs/vite/issues/6320)) ([bd9e97b](https://github.com/vitejs/vite/commit/bd9e97bd1b9156059b78b531871a12f6f47c04b1)), closes [#6148](https://github.com/vitejs/vite/issues/6148) [#6148](https://github.com/vitejs/vite/issues/6148)
|
16
|
-
* **plugin-react:** restore-jsx bug when component name is lowercase ([#6110](https://github.com/vitejs/vite/issues/6110)) ([ce65c56](https://github.com/vitejs/vite/commit/ce65c567a64fad3be4209cbd1132e62e905fe349))
|
17
|
-
|
18
|
-
|
19
|
-
### Features
|
20
|
-
|
21
|
-
* **plugin-react:** check for `api.reactBabel` on other plugins ([#5454](https://github.com/vitejs/vite/issues/5454)) ([2ab41b3](https://github.com/vitejs/vite/commit/2ab41b3184d2452be4fa0b427f05c791311644aa))
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
## [1.1.3](https://github.com/vitejs/vite/compare/plugin-react@1.1.2...plugin-react@1.1.3) (2021-12-13)
|
26
|
-
|
27
|
-
|
28
|
-
### Bug Fixes
|
29
|
-
|
30
|
-
* **plugin-react:** only detect preamble in hmr context ([#6096](https://github.com/vitejs/vite/issues/6096)) ([8735294](https://github.com/vitejs/vite/commit/8735294055ce16308a6b8302eba4538f4a2931d0))
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
## [1.1.2](https://github.com/vitejs/vite/compare/plugin-react@1.1.1...plugin-react@1.1.2) (2021-12-13)
|
35
|
-
|
36
|
-
|
37
|
-
### Bug Fixes
|
38
|
-
|
39
|
-
* ignore babel config when running restore-jsx ([#6047](https://github.com/vitejs/vite/issues/6047)) ([9c2843c](https://github.com/vitejs/vite/commit/9c2843cf0506844ee32f042a04c22c440434df2a))
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
## [1.1.1](https://github.com/vitejs/vite/compare/plugin-react@1.1.0...plugin-react@1.1.1) (2021-12-07)
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
# [1.1.0](https://github.com/vitejs/vite/compare/plugin-react@1.1.0-beta.1...plugin-react@1.1.0) (2021-11-22)
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
# [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)
|
52
|
-
|
53
|
-
|
54
|
-
### Bug Fixes
|
55
|
-
|
56
|
-
* **plugin-react:** apply `babel.plugins` to project files only ([#5255](https://github.com/vitejs/vite/issues/5255)) ([377d0be](https://github.com/vitejs/vite/commit/377d0be5cf85a50240e160beaaafda77b7199452))
|
57
|
-
* **plugin-react:** remove querystring from sourcemap filename ([#5760](https://github.com/vitejs/vite/issues/5760)) ([d93a9fa](https://github.com/vitejs/vite/commit/d93a9fab8986f3659e79d7b0b065e99ef625a5dd))
|
58
|
-
* **plugin-react:** restore usage of extension instead of id ([#5761](https://github.com/vitejs/vite/issues/5761)) ([59471b1](https://github.com/vitejs/vite/commit/59471b186612d3da0083543e23d660747d3287f3))
|
59
|
-
* **plugin-react:** uncompiled JSX in linked pkgs ([#5669](https://github.com/vitejs/vite/issues/5669)) ([41a7c9c](https://github.com/vitejs/vite/commit/41a7c9ccfbc1a7bc60aec672056eac3966ddd036))
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
# [1.1.0-beta.0](https://github.com/vitejs/vite/compare/plugin-react@1.0.6...plugin-react@1.1.0-beta.0) (2021-10-28)
|
64
|
-
|
65
|
-
|
66
|
-
### Bug Fixes
|
67
|
-
|
68
|
-
* **plugin-react:** avoid mangling the sourcemaps of virtual modules ([#5421](https://github.com/vitejs/vite/issues/5421)) ([8556ffe](https://github.com/vitejs/vite/commit/8556ffe3c59952d7e64565422bf433699e97756e))
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
## [1.0.6](https://github.com/vitejs/vite/compare/plugin-react@1.0.5...plugin-react@1.0.6) (2021-10-25)
|
73
|
-
|
74
|
-
|
75
|
-
### Bug Fixes
|
76
|
-
|
77
|
-
* **plugin-react:** account for querystring in transform hook ([#5333](https://github.com/vitejs/vite/issues/5333)) ([13c3813](https://github.com/vitejs/vite/commit/13c381368caf8302a0c5b7cec07dfc0eb344bede))
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
## [1.0.5](https://github.com/vitejs/vite/compare/plugin-react@1.0.4...plugin-react@1.0.5) (2021-10-18)
|
82
|
-
|
83
|
-
|
84
|
-
### Bug Fixes
|
85
|
-
|
86
|
-
* **plugin-react:** fix regex for react imports ([#5274](https://github.com/vitejs/vite/issues/5274)) ([00b3e4f](https://github.com/vitejs/vite/commit/00b3e4fe102652b2d92e76a05e8c7a5b766b1d03))
|
87
|
-
* **plugin-react:** transform .mjs files ([#5314](https://github.com/vitejs/vite/issues/5314)) ([8ce2ea1](https://github.com/vitejs/vite/commit/8ce2ea17d51b80c660f2cdca7844d4fc6991baed))
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
## [1.0.4](https://github.com/vitejs/vite/compare/plugin-react@1.0.3...plugin-react@1.0.4) (2021-10-11)
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
## [1.0.3](https://github.com/vitejs/vite/compare/plugin-react@1.0.2...plugin-react@1.0.3) (2021-10-11)
|
96
|
-
|
97
|
-
|
98
|
-
### Bug Fixes
|
99
|
-
|
100
|
-
* **plugin-react:** turn off jsx for .ts ([#5198](https://github.com/vitejs/vite/issues/5198)) ([916f9d3](https://github.com/vitejs/vite/commit/916f9d3984d5e83f7cb869b3606a1f043a814b97)), closes [#5102](https://github.com/vitejs/vite/issues/5102)
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
## [1.0.2](https://github.com/vitejs/vite/compare/plugin-react@1.0.1...plugin-react@1.0.2) (2021-10-05)
|
105
|
-
|
106
|
-
|
107
|
-
### Bug Fixes
|
108
|
-
|
109
|
-
* **plugin-react:** respect `opts.fastRefresh` in viteBabel ([#5139](https://github.com/vitejs/vite/issues/5139)) ([5cf4e69](https://github.com/vitejs/vite/commit/5cf4e69cd3afc7f960e02072171c7c441747e8f0))
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
## [1.0.1](https://github.com/vitejs/vite/compare/plugin-react@1.0.0...plugin-react@1.0.1) (2021-09-22)
|
114
|
-
|
115
|
-
|
116
|
-
### Bug Fixes
|
117
|
-
|
118
|
-
* **plugin-react:** inconsistent error warning ([#5031](https://github.com/vitejs/vite/issues/5031)) ([89ba8ce](https://github.com/vitejs/vite/commit/89ba8cedb8636968516bc38b37e1d2d5ed6234bb))
|
119
|
-
|
120
|
-
|
121
|
-
### Features
|
122
|
-
|
123
|
-
* **plugin-react:** pre-optimize jsx-dev-runtime ([#5036](https://github.com/vitejs/vite/issues/5036)) ([a34dd27](https://github.com/vitejs/vite/commit/a34dd2725e64fedf626e23ba9ced480f5465a59b))
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
# [1.0.0](https://github.com/vitejs/vite/compare/plugin-react@1.0.0-beta.0...plugin-react@1.0.0) (2021-09-22)
|
128
|
-
|
129
|
-
See the [readme](https://github.com/aleclarson/vite/blob/f8129ce6e87684eb7a4edd8106351c5d98207d7b/packages/plugin-react/README.md#vitejsplugin-react-) for more information.
|
130
|
-
|
131
|
-
- Support for [automatic JSX runtime](https://github.com/alloc/vite-react-jsx)
|
132
|
-
- Babel integration for both development and production builds
|
133
|
-
- Add `react` and `react-dom` to [`resolve.dedupe`](https://vitejs.dev/config/#resolve-dedupe) automatically
|
134
|
-
|
135
|
-
Thanks to @aleclarson and @pengx17 for preparing this release!
|
136
|
-
|
137
|
-
# Legacy
|
138
|
-
|
139
|
-
Before `@vitejs/plugin-react`, there was `@vitejs/plugin-react-refresh`.
|
140
|
-
|
141
|
-
See its changelog [here.](https://github.com/vitejs/vite/blob/b9e837a2aa2c1a7a8f93d4b19df9f72fd3c6fb09/packages/plugin-react-refresh/CHANGELOG.md)
|