vite-ssg: using latest packages vite-ssg build throws Invalid value used as weak map key
when i run vite build, it completed successfully. but when i run npx vite-ssg build (building for server…)
(node:11183) UnhandledPromiseRejectionWarning: Error: [vite-ssg] Error on page: /
TypeError: Invalid value used as weak map key
at WeakMap.set (<anonymous>)
at normalizePropsOptions (project/node_modules/.pnpm/@vue+runtime-core@3.2.26/node_modules/@vue/runtime-core/dist/runtime-core.cjs.prod.js:2166:15)
at createComponentInstance (project/node_modules/.pnpm/@vue+runtime-core@3.2.26/node_modules/@vue/runtime-core/dist/runtime-core.cjs.prod.js:5026:23)
at renderComponentVNode (project/node_modules/.pnpm/@vue+server-renderer@3.2.26_vue@3.2.26/node_modules/@vue/server-renderer/dist/server-renderer.cjs.prod.js:194:22)
at ssrRenderComponent (project/node_modules/.pnpm/@vue+server-renderer@3.2.26_vue@3.2.26/node_modules/@vue/server-renderer/dist/server-renderer.cjs.prod.js:620:12)
at file://project/.vite-ssg-temp/main.mjs:1770:13
at renderComponentSubTree (project/node_modules/.pnpm/@vue+server-renderer@3.2.26_vue@3.2.26/node_modules/@vue/server-renderer/dist/server-renderer.cjs.prod.js:260:13)
at renderComponentVNode (project/node_modules/.pnpm/@vue+server-renderer@3.2.26_vue@3.2.26/node_modules/@vue/server-renderer/dist/server-renderer.cjs.prod.js:211:16)
at renderVNode (project/node_modules/.pnpm/@vue+server-renderer@3.2.26_vue@3.2.26/node_modules/@vue/server-renderer/dist/server-renderer.cjs.prod.js:301:22)
at renderComponentSubTree (project/node_modules/.pnpm/@vue+server-renderer@3.2.26_vue@3.2.26/node_modules/@vue/server-renderer/dist/server-renderer.cjs.prod.js:266:13)
at project/node_modules/.pnpm/vite-ssg@0.17.5_97bac1ad760e801e4df55702908e73e1/node_modules/vite-ssg/dist/node/cli.cjs:223:13
at async Promise.all (index 0)
at async build (project/node_modules/.pnpm/vite-ssg@0.17.5_97bac1ad760e801e4df55702908e73e1/node_modules/vite-ssg/dist/node/cli.cjs:196:3)
at async Object.handler (project/node_modules/.pnpm/vite-ssg@0.17.5_97bac1ad760e801e4df55702908e73e1/node_modules/vite-ssg/dist/node/cli.cjs:294:3)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:11183) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 9)
(node:11183) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
my package.json
{
"private": true,
"scripts": {
"serve": "vite preview",
"build": "cross-env NODE_ENV=production vite-ssg build",
"lint": "eslint \"**/*.{vue,ts,js}\"",
"dev": "vite",
"preview": "vite preview",
"preview-https": "serve dist",
"test": "cypress open",
"typecheck": "vue-tsc --noEmit"
},
"dependencies": {
"@ant-design/icons-vue": "^6.0.1",
"@mdi/font": "6.5.95",
"@vueuse/core": "^7.5.3",
"@vueuse/head": "^0.7.4",
"ant-design-vue": "^3.0.0-beta.4",
"axios": "^0.24.0",
"dotenv-flow": "^3.2.0",
"less": "^4.1.2",
"material-design-icons": "^3.0.1",
"moment": "^2.29.1",
"nprogress": "^0.2.0",
"pinia": "^2.0.9",
"postcss": "^8.4.5",
"prism-theme-vars": "^0.2.2",
"realm-web": "^1.5.1",
"roboto-fontface": "*",
"sass": "^1.46.0",
"unplugin-icons": "^0.13.0",
"vite-plugin-style-import": "^1.4.1",
"vue": "^3.2.26",
"vue-demi": "^0.12.1",
"vue-i18n": "^9.1.9",
"vue-router": "^4.0.12",
"vue-template-compiler": "^2.6.14",
"vuelidate": "^0.7.7",
"vuex": "^4.0.2",
"vuex-persistedstate": "^4.1.0",
"webfontloader": "^1.6.28"
},
"devDependencies": {
"@antfu/eslint-config": "^0.15.0",
"@babel/core": "^7.16.7",
"@iconify-json/carbon": "^1.0.12",
"@iconify-json/fa": "^1.0.1",
"@iconify-json/ri": "^1.0.2",
"@intlify/vite-plugin-vue-i18n": "^3.2.1",
"@types/nprogress": "^0.2.0",
"@vitejs/plugin-vue": "^2.0.1",
"@vue/cli-plugin-babel": "5.0.0-beta.7",
"@vue/cli-service": "5.0.0-beta.7",
"@vue/compiler-sfc": "^3.2.26",
"@vue/server-renderer": "^3.2.26",
"critters": "^0.0.16",
"cross-env": "^7.0.3",
"eslint": "^8.6.0",
"eslint-plugin-cypress": "^2.12.1",
"https-localhost": "^4.7.0",
"pnpm": "^6.25.0",
"sass": "^1.46.0",
"typescript": "^4.5.4",
"unplugin-auto-import": "^0.5.5",
"unplugin-vue-components": "^0.17.11",
"vite": "^2.7.10",
"vite-plugin-inspect": "^0.3.13",
"vite-plugin-md": "^0.11.7",
"vite-plugin-pages": "^0.19.9",
"vite-plugin-pwa": "^0.11.12",
"vite-plugin-vue-layouts": "^0.5.0",
"vite-plugin-windicss": "^1.6.1",
"vite-ssg": "^0.17.5",
"vue-tsc": "^0.30.2"
},
"prettier": {
"singleQuote": true,
"semi": false
}
}
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 1
- Comments: 19 (4 by maintainers)
Normally every time I facing this problem is most related to a invalid DOM element in vue template, try to comment out code page by page then go smaller scale, finally you will find it.
@hannoeru that is sad case, same here
I got the same issue because I’ve a wrong element name
<class i-carbon-copy />
, it was just a typoCome across similar issue, but in my case is happened after I upgrade to
vite v3
, once I revert back tovite v2
everything’s works just fine.Here’s my error output, just in case
@u007 there is no way man, I also test your repo with #239 (you can check it using a previous variant here https://github.com/antfu/vite-ssg/issues/150#issuecomment-1113997316, for context read this entry https://github.com/antfu/vite-ssg/issues/150#issuecomment-1113992002 but use the
tgz
from former comment) removingstyleImport
plugin and addingAntDesignVueResolver({ cjs: true })
but now I get this error when building SSR (it is too slow to run dev and build):