-
-
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-core): adding identifier on validAssetId if variable name
has specific character
#4429
Conversation
f7a5607
to
e5457f9
Compare
@@ -430,6 +430,14 @@ export function toValidAssetId( | |||
name: string, | |||
type: 'component' | 'directive' | 'filter' | |||
): string { | |||
// see issue#4422, we need adding identifier on validAssetId if variable `name` has specific character |
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.
I prefer this:
return `_${type}_${name.replace(/[^\w]/g, function($1,$2){
return $1==='-'?'_': name.charCodeAt($2)
})}`
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.
Yes, I think change it in this way is better.
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.
Done.
…me` has specific character
e5457f9
to
0606c78
Compare
Hello, thank you very much for your efforts. I have a small question here. Maybe there is no need to deal with this issue, just for communication. If a situation like this occurs, there will still be conflicts.
Is it possible to consider using Map() to implement name conversion, it should be able to completely solve this problem.
|
@qq974969638 |
Hello, you can view this error demo. I don't know if this issue needs to be dealt with, it's just for communication.
|
@qq974969638 I think it's a very very very very edge case. |
see issue #4422
If component name is not strict, the generated render function will not run.
We can solve this edge case by adding an unique identifier on specific
validAssetId
.Close #4422