Skip to content

Commit 44d6ee1

Browse files
committed
chore: fix oxc option convertion and reduce warnings
1 parent 32c552e commit 44d6ee1

File tree

1 file changed

+10
-5
lines changed
  • packages/vite/src/node/plugins

1 file changed

+10
-5
lines changed

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

+10-5
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,9 @@ export async function transformWithOxc(
9696
resolvedOptions.jsx.runtime = 'automatic'
9797
break
9898
case 'preserve':
99-
ctx.warn('The tsconfig jsx preserve is not supported by oxc')
99+
if (lang === 'tsx') {
100+
ctx.warn('The tsconfig jsx preserve is not supported by oxc')
101+
}
100102
break
101103
default:
102104
break
@@ -287,9 +289,7 @@ export function convertEsbuildConfigToOxcConfig(
287289
oxcOptions.jsx!.importSource = esbuildTransformOptions.jsxImportSource
288290
}
289291
if (esbuildTransformOptions.loader) {
290-
if (
291-
['.js', '.jsx', '.ts', 'tsx'].includes(esbuildTransformOptions.loader)
292-
) {
292+
if (['js', 'jsx', 'ts', 'tsx'].includes(esbuildTransformOptions.loader)) {
293293
oxcOptions.lang = esbuildTransformOptions.loader as
294294
| 'js'
295295
| 'jsx'
@@ -310,7 +310,12 @@ export function convertEsbuildConfigToOxcConfig(
310310
case false:
311311
oxcOptions.sourcemap = esbuildTransformOptions.sourcemap
312312
break
313-
313+
case 'external':
314+
oxcOptions.sourcemap = true
315+
break
316+
// ignore it because it's not supported by esbuild `transform`
317+
case 'linked':
318+
break
314319
default:
315320
logger.warn(
316321
`The esbuild sourcemap ${esbuildTransformOptions.sourcemap} is not supported by oxc`,

0 commit comments

Comments
 (0)