Skip to content

Commit 2e72126

Browse files
committed
fix: generate sourcemap in oxc plugin
1 parent 66465a2 commit 2e72126

File tree

1 file changed

+8
-1
lines changed
  • packages/vite/src/node/plugins

1 file changed

+8
-1
lines changed

packages/vite/src/node/plugins/oxc.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@ const UMD_BEGIN_RE = /\(this,\s*function\([^()]*\)\s*\{\s*"use strict";/
3333
const jsxExtensionsRE = /\.(?:j|t)sx\b/
3434
const validExtensionRE = /\.\w+$/
3535

36-
export interface OxcOptions extends OxcTransformOptions {
36+
export interface OxcOptions
37+
extends Exclude<
38+
OxcTransformOptions,
39+
'cwd' | 'sourceType' | 'lang' | 'sourcemap' | 'helpers'
40+
> {
3741
include?: string | RegExp | ReadonlyArray<string | RegExp>
3842
exclude?: string | RegExp | ReadonlyArray<string | RegExp>
3943
jsxInject?: string
@@ -321,6 +325,9 @@ export function oxcPlugin(config: ResolvedConfig): Plugin {
321325
) {
322326
oxcTransformOptions.lang = 'jsx'
323327
}
328+
oxcTransformOptions.sourcemap =
329+
this.environment.mode !== 'build' ||
330+
!!this.environment.config.build.sourcemap
324331

325332
const result = await transformWithOxc(
326333
this,

0 commit comments

Comments
 (0)