You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
None ascii characters will be tranformed to \uxxx,
As a example, you can see generate code by vitepress in vite cn docs at https://cn.vitejs.dev/.
I am not pretty sure if vite "Choosed" to do this, but this is heavily increasing outputsize if the source content contains lots of static content with none ascii characters.
For a quick review for esbuild and vite, I think that esbuild provide charset and with it set to utf-8, none assii character like CJK characters or emoji can be preserved as is in js output code. However, vite seems not providing such a option.
I thint that even if vite choose to do this for compatability reasons, users should have alibilty to not covert them. I understand that this is not having a great increasement under gzip, but it does slower the deployment speed.
Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
I think we should explore changing the default in Vite 4. See #9870. Rollup ended up changing the markers so it isn't longer needed, but it still surprising to me.
Describe the bug
None ascii characters will be tranformed to
\uxxx
,I am not pretty sure if vite "Choosed" to do this, but this is heavily increasing outputsize if the source content contains lots of static content with none ascii characters.
For a quick review for esbuild and vite, I think that esbuild provide
charset
and with it set toutf-8
, none assii character like CJK characters or emoji can be preserved as is in js output code. However, vite seems not providing such a option.I thint that even if vite choose to do this for compatability reasons, users should have alibilty to not covert them. I understand that this is not having a great increasement under gzip, but it does slower the deployment speed.
Reproduction
https://stackblitz.com/edit/vitejs-vite-yftodz?file=main.js&terminal=dev
Steps to reproduce
No response
System Info
Test in stackblitz with links above.
Used Package Manager
npm
Logs
My demo results:
And I don' think I should get
const a="\u4E00\u4E9B\u975E ASCII \u7684\u5B57\u7B26\u3002"
instead ofconst a= '一些非 ASCII 的字符。'
Validations
The text was updated successfully, but these errors were encountered: