Skip to content

Commit

Permalink
fix: convert fileUrl to path before compile
Browse files Browse the repository at this point in the history
this commit convert fileUrl to path before compile in esm, this may cause path alias resolve issue

close swc-project#753
  • Loading branch information
yeliex authored Feb 5, 2024
1 parent 28c0a99 commit 8e25c4c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/register/esm.mts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export const load: LoadFn = async (url, context, nextLoad) => {
if (context.format === 'ts') {
const { source } = await nextLoad(url, context)
const code = typeof source === 'string' ? source : Buffer.from(source).toString()
const compiled = await compile(code, url, tsconfig, true)
const compiled = await compile(code, fileURLToPath(url), tsconfig, true)
return {
format: 'module',
source: compiled,
Expand Down

0 comments on commit 8e25c4c

Please sign in to comment.