Skip to content

Commit

Permalink
fix: transform import.meta.url in config files
Browse files Browse the repository at this point in the history
fix #1511
  • Loading branch information
yyx990803 committed Jan 13, 2021
1 parent 4857c01 commit 98e57de
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/vite/src/node/config.ts
Expand Up @@ -486,7 +486,16 @@ async function bundleConfigFile(
root: path.dirname(fileName),
isBuild: true,
asSrc: false
})
}),
{
name: 'replace-import-meta',
transform(code, id) {
return code.replace(
/\bimport\.meta\.url\b/g,
JSON.stringify(`file://${id}`)
)
}
}
]
})

Expand Down

0 comments on commit 98e57de

Please sign in to comment.