From 12f005c82ade9f0430a5bd755df24b2af6fc8d90 Mon Sep 17 00:00:00 2001 From: Alec Larson <1925840+aleclarson@users.noreply.github.com> Date: Mon, 25 Oct 2021 19:05:48 -0400 Subject: [PATCH] fix(plugin-react): avoid mangling the sourcemaps of virtual modules MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously, the `sources` array within a virtual moduleā€˜s sourcemap would contain the basename (characters after the last "/") rather than the entire `id` string, which would trigger a "Sourcemap points to missing source files" warning for each virtual module. --- packages/plugin-react/src/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/plugin-react/src/index.ts b/packages/plugin-react/src/index.ts index b53ed9121fb9e6..ad0e24366d61d4 100644 --- a/packages/plugin-react/src/index.ts +++ b/packages/plugin-react/src/index.ts @@ -199,6 +199,7 @@ export default function viteReact(opts: Options = {}): PluginOption[] { ast: !isReasonReact, root: projectRoot, filename: id, + sourceFileName: id, parserOpts: { ...opts.babel?.parserOpts, sourceType: 'module',