Skip to content

Commit

Permalink
fix: replace import.meta.url correctly (#7792)
Browse files Browse the repository at this point in the history
  • Loading branch information
sapphi-red committed Apr 18, 2022
1 parent 6198911 commit 12d1194
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/vite/src/node/config.ts
Expand Up @@ -31,7 +31,7 @@ import { createLogger } from './logger'
import type { DepOptimizationOptions } from './optimizer'
import { createFilter } from '@rollup/pluginutils'
import type { ResolvedBuildOptions } from '.'
import { parse as parseUrl } from 'url'
import { parse as parseUrl, pathToFileURL } from 'url'
import type { JsonOptions } from './plugins/json'
import type { PluginContainer } from './server/pluginContainer'
import { createPluginContainer } from './server/pluginContainer'
Expand Down Expand Up @@ -1008,7 +1008,7 @@ async function bundleConfigFile(
contents: contents
.replace(
/\bimport\.meta\.url\b/g,
JSON.stringify(`file://${args.path}`)
JSON.stringify(pathToFileURL(args.path).href)
)
.replace(
/\b__dirname\b/g,
Expand Down

0 comments on commit 12d1194

Please sign in to comment.