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
In the module file for vue-i18n multi-language support, a lodash method is imported with import { floor } from 'lodash';, but this lodash method is not used. After packaging with vite, it is found that tree-shaking does not work, and the entire lodash file is packaged into the final output JS. Moreover, after the vue app starts, the page goes blank, and no error messages are displayed in the browser console. Setting breakpoints in the output files reveals that the multi-language module JS imports the main JS file, and the methods in the main JS file dynamically import this multi-language module JS file, resulting in a circular reference issue.
this is ZH-CN.js , import floor function but not use
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
vite-app-import-lodash-circular-reference-issue
vite-app-import-lodash-circular-reference-issue
In the module file for vue-i18n multi-language support, a lodash method is imported with
import { floor } from 'lodash';, but this lodash method is not used. After packaging with vite, it is found that tree-shaking does not work, and the entire lodash file is packaged into the final output JS. Moreover, after the vue app starts, the page goes blank, and no error messages are displayed in the browser console. Setting breakpoints in the output files reveals that the multi-language module JS imports the main JS file, and the methods in the main JS file dynamically import this multi-language module JS file, resulting in a circular reference issue.this is
ZH-CN.js, import floor function but not usethis is
i18n.jsthis is
main.jsthis code fragment is in vite build main js (
dist\assets\index-wFQsXaez.js) :this is vite build
ZH-CN.js:you can see
index-wFQsXaez.jsimportZH-CH.js, andZH-CN.jsimportindex-wFQsXaez.js, there is a circular reference issue.Is this phenomenon a bug?
Beta Was this translation helpful? Give feedback.
All reactions