Skip to content

Commit

Permalink
chore: add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
bluwy committed Sep 28, 2023
1 parent 01cbea8 commit 6fec6ab
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/vite/src/node/plugins/importAnalysis.ts
Expand Up @@ -470,6 +470,10 @@ export function importAnalysisPlugin(config: ResolvedConfig): Plugin {
}
return
} else if (templateLiteralRE.test(rawUrl)) {
// If the import has backticks but isn't transformed as a glob import
// (as there's nothing to glob), check if it's simply a plain string.
// If so, we can replace the specifier as a plain string to prevent
// an incorrect "cannot be analyzed" warning.
if (!(rawUrl.includes('${') && rawUrl.includes('}'))) {
specifier = rawUrl.replace(templateLiteralRE, '$1')
}
Expand Down

0 comments on commit 6fec6ab

Please sign in to comment.