@vitejs/plugin-react
Advanced tools
Comparing version 1.0.4 to 1.0.5
@@ -0,1 +1,11 @@ | ||
## [1.0.5](https://github.com/vitejs/vite/compare/plugin-react@1.0.4...plugin-react@1.0.5) (2021-10-18) | ||
### Bug Fixes | ||
* **plugin-react:** fix regex for react imports ([#5274](https://github.com/vitejs/vite/issues/5274)) ([00b3e4f](https://github.com/vitejs/vite/commit/00b3e4fe102652b2d92e76a05e8c7a5b766b1d03)) | ||
* **plugin-react:** transform .mjs files ([#5314](https://github.com/vitejs/vite/issues/5314)) ([8ce2ea1](https://github.com/vitejs/vite/commit/8ce2ea17d51b80c660f2cdca7844d4fc6991baed)) | ||
## [1.0.4](https://github.com/vitejs/vite/compare/plugin-react@1.0.3...plugin-react@1.0.4) (2021-10-11) | ||
@@ -2,0 +12,0 @@ |
@@ -334,3 +334,3 @@ var __create = Object.create; | ||
const userParserPlugins = opts.parserPlugins || ((_c = (_b = opts.babel) == null ? void 0 : _b.parserOpts) == null ? void 0 : _c.plugins) || []; | ||
const importReactRE = /(^|\n)import\s+(\*\s+as\s+)?React\s+/; | ||
const importReactRE = /(^|\n)import\s+(\*\s+as\s+)?React(,|\s+)/; | ||
const viteBabel = { | ||
@@ -356,3 +356,3 @@ name: "vite:react-babel", | ||
var _a2, _b2; | ||
if (/\.[tj]sx?$/.test(id)) { | ||
if (/\.(mjs|[tj]sx?)$/.test(id)) { | ||
const plugins = [...userPlugins]; | ||
@@ -359,0 +359,0 @@ const parserPlugins = [ |
{ | ||
"name": "@vitejs/plugin-react", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "author": "Evan You", |
@@ -61,3 +61,7 @@ import type { ParserOptions, TransformOptions, types as t } from '@babel/core' | ||
const importReactRE = /(^|\n)import\s+(\*\s+as\s+)?React\s+/ | ||
// Support pattens like: | ||
// - import * as React from 'react'; | ||
// - import React from 'react'; | ||
// - import React, {useEffect} from 'react'; | ||
const importReactRE = /(^|\n)import\s+(\*\s+as\s+)?React(,|\s+)/ | ||
@@ -96,3 +100,3 @@ const viteBabel: Plugin = { | ||
async transform(code, id, ssr) { | ||
if (/\.[tj]sx?$/.test(id)) { | ||
if (/\.(mjs|[tj]sx?)$/.test(id)) { | ||
const plugins = [...userPlugins] | ||
@@ -99,0 +103,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
52796
1297