Skip to content

Commit 6fec6ab

Browse files
committed
chore: add comment
1 parent 01cbea8 commit 6fec6ab

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,10 @@ export function importAnalysisPlugin(config: ResolvedConfig): Plugin {
470470
}
471471
return
472472
} else if (templateLiteralRE.test(rawUrl)) {
473+
// If the import has backticks but isn't transformed as a glob import
474+
// (as there's nothing to glob), check if it's simply a plain string.
475+
// If so, we can replace the specifier as a plain string to prevent
476+
// an incorrect "cannot be analyzed" warning.
473477
if (!(rawUrl.includes('${') && rawUrl.includes('}'))) {
474478
specifier = rawUrl.replace(templateLiteralRE, '$1')
475479
}

0 commit comments

Comments
 (0)