Skip to content

Commit

Permalink
fix: generate sourcemap in oxc plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
sapphi-red committed Jan 10, 2025
1 parent 66465a2 commit 2e72126
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/vite/src/node/plugins/oxc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ const UMD_BEGIN_RE = /\(this,\s*function\([^()]*\)\s*\{\s*"use strict";/
const jsxExtensionsRE = /\.(?:j|t)sx\b/
const validExtensionRE = /\.\w+$/

export interface OxcOptions extends OxcTransformOptions {
export interface OxcOptions
extends Exclude<
OxcTransformOptions,
'cwd' | 'sourceType' | 'lang' | 'sourcemap' | 'helpers'
> {
include?: string | RegExp | ReadonlyArray<string | RegExp>
exclude?: string | RegExp | ReadonlyArray<string | RegExp>
jsxInject?: string
Expand Down Expand Up @@ -321,6 +325,9 @@ export function oxcPlugin(config: ResolvedConfig): Plugin {
) {
oxcTransformOptions.lang = 'jsx'
}
oxcTransformOptions.sourcemap =
this.environment.mode !== 'build' ||
!!this.environment.config.build.sourcemap

const result = await transformWithOxc(
this,
Expand Down

0 comments on commit 2e72126

Please sign in to comment.