Skip to content

Commit

Permalink
fix(import-analysis): fix literal dynamic id false positive
Browse files Browse the repository at this point in the history
fix #1902
  • Loading branch information
yyx990803 committed Feb 8, 2021
1 parent 92934d4 commit 6a6508e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/vite/src/node/plugins/importAnalysis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ export function importAnalysisPlugin(config: ResolvedConfig): Plugin {
hasViteIgnore = /\/\*\s*@vite-ignore\s*\*\//.test(url)
// #998 remove comment
url = url.replace(/\/\*[\s\S]*?\*\/|([^\\:]|^)\/\/.*$/gm, '').trim()
const literalIdMatch = url.match(/^'([^']+)'|"([^"]+)"$/)
const literalIdMatch = url.match(/^(?:'([^']+)'|"([^"]+)")$/)
if (literalIdMatch) {
isLiteralDynamicId = true
url = literalIdMatch[1] || literalIdMatch[2]
Expand Down

0 comments on commit 6a6508e

Please sign in to comment.