fix(compiler-core): fix duplicated component identifier for names with non-ascii chars (#4429)
fix #4422
This commit is contained in:
@@ -430,7 +430,10 @@ export function toValidAssetId(
|
||||
name: string,
|
||||
type: 'component' | 'directive' | 'filter'
|
||||
): string {
|
||||
return `_${type}_${name.replace(/[^\w]/g, '_')}`
|
||||
// see issue#4422, we need adding identifier on validAssetId if variable `name` has specific character
|
||||
return `_${type}_${name.replace(/[^\w]/g, (searchValue, replaceValue) => {
|
||||
return searchValue === '-' ? '_' : name.charCodeAt(replaceValue).toString()
|
||||
})}`
|
||||
}
|
||||
|
||||
// Check if a node contains expressions that reference current context scope ids
|
||||
|
||||
Reference in New Issue
Block a user