-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(compiler-sfc): don't match property access in dev mode import usage check #8897
Conversation
@@ -20,7 +20,7 @@ export function isImportUsed(local: string, sfc: SFCDescriptor): boolean { | |||
return new RegExp( | |||
// #4274 escape $ since it's a special char in regex | |||
// (and is the only regex special char that is valid in identifiers) | |||
`[^\\w$_]${local.replace(/\$/g, '\\$')}[^\\w$_]` | |||
`[^\\w$.]${local.replace(/\$/g, '\\$')}[^\\w$]` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we also need to account for .
being used as part of a spread operator? e.g.:
I also wonder whether we should account whitespace after .
operators. e.g. Foo . Bar . Baz
?
I decided to rethink how import usage check should work and implemented AST-based checks in #9729 Still, thanks for the PR! |
nuxt/nuxt#22416