Skip to content

Commit

Permalink
fix: dedupe prepend
Browse files Browse the repository at this point in the history
  • Loading branch information
sapphi-red committed Jul 9, 2022
1 parent 9569821 commit 6ae7d3f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/plugin-react/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,11 +276,13 @@ export default function viteReact(opts: Options = {}): PluginOption[] {

let inputMap: SourceMap | undefined
if (prependReactImport) {
code = prependReactImportCode + code
if (needHiresSourcemap) {
const s = new MagicString(code)
s.prepend(prependReactImportCode)
code = s.toString()
inputMap = s.generateMap({ hires: true, source: id })
} else {
code = prependReactImportCode + code
}
}

Expand Down

0 comments on commit 6ae7d3f

Please sign in to comment.