diff --git a/packages/plugin-react/src/index.ts b/packages/plugin-react/src/index.ts index 98682d347726ac..12f1914d546df1 100644 --- a/packages/plugin-react/src/index.ts +++ b/packages/plugin-react/src/index.ts @@ -215,7 +215,7 @@ export default function viteReact(opts: Options = {}): PluginOption[] { ast: !isReasonReact, root: projectRoot, filename: id, - sourceFileName: id, + sourceFileName: filepath, parserOpts: { ...opts.babel?.parserOpts, sourceType: 'module',