Skip to content
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

使用ts时,模板字符串匹配存在问题 #11

Open
Banana-energy opened this issue Sep 13, 2024 · 2 comments
Open

使用ts时,模板字符串匹配存在问题 #11

Banana-energy opened this issue Sep 13, 2024 · 2 comments

Comments

@Banana-energy
Copy link

具体可看demo
https://github.com/Banana-energy/rollup-plugin-i18n-auto-issuse
排查之后发现是const hasWord = path.node.quasis.some(item => localePattern.test(item.value.raw))这里正则匹配没通过

理论上应该是没问题的,经过ts的编译后中文会转义为Unicode字符,然而应该还是能匹配上才对
image
image

@Banana-energy
Copy link
Author

image

@Banana-energy
Copy link
Author

原因是转义之后单个文字变成了6 个字符(, u, 6, D, 4, B),并不是单个中文字符

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant