Skip to content

Commit f66be46

Browse files
committed
fix: avoid using PluginContext#parse
1 parent ff7fa38 commit f66be46

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import path from 'node:path'
22
import MagicString from 'magic-string'
33
import { stripLiteral } from 'strip-literal'
4+
import { parseAst } from 'rollup/parseAst'
45
import type { Plugin } from '../plugin'
56
import type { ResolvedConfig } from '../config'
67
import type { ResolveFn } from '../'
@@ -12,7 +13,6 @@ import { preloadHelperId } from './importAnalysisBuild'
1213
import type { InternalResolveOptions } from './resolve'
1314
import { tryFsResolve } from './resolve'
1415
import { hasViteIgnoreRE } from './importAnalysis'
15-
1616
/**
1717
* Convert `new URL('./foo.png', import.meta.url)` to its resolved built URL
1818
*
@@ -71,7 +71,7 @@ export function assetImportMetaUrlPlugin(config: ResolvedConfig): Plugin {
7171
const queryString = hasQueryDelimiter
7272
? rawUrl.slice(queryDelimiterIndex, -1)
7373
: ''
74-
const ast = this.parse(pureUrl)
74+
const ast = parseAst(pureUrl)
7575
const templateLiteral = (ast as any).body[0].expression
7676
if (templateLiteral.expressions.length) {
7777
const pattern = buildGlobPattern(templateLiteral)

0 commit comments

Comments
 (0)