异常信息
PS E:\myworkpace\blog\JavaPub-Blog> yarn docs:build yarn run v1.22.18 $ vuepress build docs info Initializing VuePress and preparing data... ⠦ Compiling with viteUse of eval is strongly discouraged, as it poses security risks and may cause issues with minification Use of eval is strongly discouraged, as it poses security risks and may cause issues with minification ⠼ Compiling with viteUse of eval is strongly discouraged, as it poses security risks and may cause issues with minification Use of eval is strongly discouraged, as it poses security risks and may cause issues with minification ⠏ Compiling with vite (!) Some chunks are larger than 500 KiB after minification. Consider: - Using dynamic import() to code-split the application - Use build.rollupOptions.output.manualChunks to improve chunking: https://rollupjs.org/guide/en/#outputmanualchunks - Adjust chunk size limit for this warning via build.chunkSizeWarningLimit. ✔ Compiling with vite - done ✖ Rendering pages - failed TypeError: Invalid value used as weak map key at WeakMap.set (<anonymous>) at normalizePropsOptions (E:\myworkpace\blog\JavaPub-Blog\node_modules\@vue\runtime-core\dist\runtime-core.cjs.prod.js:2755:15) at createComponentInstance (E:\myworkpace\blog\JavaPub-Blog\node_modules\@vue\runtime-core\dist\runtime-core.cjs.prod.js:5644:23) at renderComponentVNode (E:\myworkpace\blog\JavaPub-Blog\node_modules\@vue\server-renderer\dist\server-renderer.cjs.prod.js:194:22) at Object.ssrRenderComponent (E:\myworkpace\blog\JavaPub-Blog\node_modules\@vue\server-renderer\dist\server-renderer.cjs.prod.js:626:12) at _sfc_ssrRender$X (E:\myworkpace\blog\JavaPub-Blog\docs\.vuepress\dist\.server\app.js:10145:24) at renderComponentSubTree (E:\myworkpace\blog\JavaPub-Blog\node_modules\@vue\server-renderer\dist\server-renderer.cjs.prod.js:266:13) at renderComponentVNode (E:\myworkpace\blog\JavaPub-Blog\node_modules\@vue\server-renderer\dist\server-renderer.cjs.prod.js:211:16) at renderVNode (E:\myworkpace\blog\JavaPub-Blog\node_modules\@vue\server-renderer\dist\server-renderer.cjs.prod.js:307:22) at renderComponentSubTree (E:\myworkpace\blog\JavaPub-Blog\node_modules\@vue\server-renderer\dist\server-renderer.cjs.prod.js:272:13) error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
原因
vite打包报错:块的大小超过限制,Some chunks are larger than 500kb after minification
解决
vuepress2.x 是基于 Vue3.x开发,相比 Vuepress1.x 对 html 的使用更严格。如下图所示的非标准 html 标签在开发阶段没问题,编译却无法通过。
<font 标签已弃用