Skip to content

Commit b789fbe

Browse files
authored
fix: only try to .js files and not jsons
1 parent 0284d09 commit b789fbe

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/esbuildImportMetaUrlPlugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default <Plugin>{
77
name: 'import.meta.url',
88
setup ({ onLoad }) {
99
// Help vite that bundles/move files in dev mode without touching `import.meta.url` which breaks asset urls
10-
onLoad({ filter: /.*\.js/, namespace: 'file' }, async args => {
10+
onLoad({ filter: /.*\.js$/, namespace: 'file' }, async args => {
1111
const code = fs.readFileSync(args.path, 'utf8')
1212

1313
const assetImportMetaUrlRE = /\bnew\s+URL\s*\(\s*('[^']+'|"[^"]+"|`[^`]+`)\s*,\s*import\.meta\.url\s*(?:,\s*)?\)/g

0 commit comments

Comments
 (0)