From 59471b186612d3da0083543e23d660747d3287f3 Mon Sep 17 00:00:00 2001 From: Fran Dios Date: Sat, 20 Nov 2021 02:27:09 +0900 Subject: [PATCH] fix(plugin-react): restore usage of extension instead of id (#5761) --- packages/plugin-react/src/index.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/plugin-react/src/index.ts b/packages/plugin-react/src/index.ts index 98682d347726ac..16675f774ee8d9 100644 --- a/packages/plugin-react/src/index.ts +++ b/packages/plugin-react/src/index.ts @@ -198,15 +198,15 @@ export default function viteReact(opts: Options = {}): PluginOption[] { 'classPrivateMethods' ] - if (!id.endsWith('.ts')) { + if (!extension.endsWith('.ts')) { parserPlugins.push('jsx') } - if (/\.tsx?$/.test(id)) { + if (/\.tsx?$/.test(extension)) { parserPlugins.push('typescript') } - const isReasonReact = id.endsWith('.bs.js') + const isReasonReact = extension.endsWith('.bs.js') const babelOpts: TransformOptions = { babelrc: false,