Production build + custom vue lib + ssr
See original GitHub issueEnvironment
npx nuxi info:
------------------------------
- Operating System: `Darwin`
- Node Version: `v16.13.1`
- Nuxt Version: `3.0.0-27338323.1e98259`
- Package Manager: `yarn@1.22.17`
- Bundler: `Vite`
- User Config: `-`
- Runtime Modules: `-`
- Build Modules: `-`
------------------------------
vue version 3.2.26
(same for nuxt project and vue lib)
Reproduction
https://github.com/Jamshoot66/nuxt3-ui-lib-example There are two projects:
-
nuxt-project
- project to reproduce the bug commands to start project:yarn
yarn build && yarn start
-
ui-lib
- example of external lib. Also, it is published to npm asui-lib-for-nuxt-slot-issue
Describe the bug
I’m working on vue3 ui library and trying to add SSR support. So, the problem is SSR fails after production build (yarn build && yarn start
).
There are 2 components in the example
- Simple hello world component
HelloWorld
- Component with slot
HelloSlot
Both of them leads to errors in production build:
[Vue warn]: [@vue/server-renderer] Invalid VNode type: Symbol(Fragment) (symbol)
Yes, it’s market as warn, but the component does not render on the server-side and it is an error to me.
Slotted component HelloSlot
throws
TypeError: Cannot read properties of null (reading 'isCE')
, 'couse currentRenderingInstance
is null
nuxt config:
export default defineNuxtConfig({
vite: {
resolve: {
alias: {
"@vue": path.resolve(__dirname, './node_modules/@vue'),
"vue": path.resolve(__dirname, './node_modules/vue'),
},
// error when use dedupe:
// "require is not defined in ES module scope, you can use import instead"
// fixing server.mjs does not help with ssr issue
// dedupe: ['vue', '@vue'],
preserveSymlinks: false,
}
}
})
Additional context
Only production build
Logs
[Vue warn]: [@vue/server-renderer] Invalid VNode type: Symbol(Fragment) (symbol)
TypeError: Cannot read properties of null (reading 'isCE')
at renderSlot (/Users/jamshoot/Documents/projects/__tests/nuxt3/nuxt3-ui-lib-example/nuxt-project/.output/server/node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:5799:34)
at Proxy.render (/Users/jamshoot/Documents/projects/__tests/nuxt3/nuxt3-ui-lib-example/nuxt-project/.output/server/node_modules/ui-lib-for-nuxt-slot-issue/dist/ui-lib-for-nuxt-slot-issue.common.js:245:301)
at renderComponentRoot (file:///Users/jamshoot/Documents/projects/__tests/nuxt3/nuxt3-ui-lib-example/nuxt-project/.output/server/chunks/index.mjs:2019:44)
at renderComponentSubTree (file:///Users/jamshoot/Documents/projects/__tests/nuxt3/nuxt3-ui-lib-example/nuxt-project/.output/server/chunks/index.mjs:9866:51)
at renderComponentVNode (file:///Users/jamshoot/Documents/projects/__tests/nuxt3/nuxt3-ui-lib-example/nuxt-project/.output/server/chunks/index.mjs:9811:16)
at Object.ssrRenderComponent (file:///Users/jamshoot/Documents/projects/__tests/nuxt3/nuxt3-ui-lib-example/nuxt-project/.output/server/chunks/index.mjs:10220:12)
at _sfc_ssrRender (file:///Users/jamshoot/Documents/projects/__tests/nuxt3/nuxt3-ui-lib-example/nuxt-project/.output/server/chunks/app/server.mjs:3263:32)
at renderComponentSubTree (file:///Users/jamshoot/Documents/projects/__tests/nuxt3/nuxt3-ui-lib-example/nuxt-project/.output/server/chunks/index.mjs:9860:13)
at renderComponentVNode (file:///Users/jamshoot/Documents/projects/__tests/nuxt3/nuxt3-ui-lib-example/nuxt-project/.output/server/chunks/index.mjs:9811:16)
at renderVNode (file:///Users/jamshoot/Documents/projects/__tests/nuxt3/nuxt3-ui-lib-example/nuxt-project/.output/server/chunks/index.mjs:9901:22)
Issue Analytics
- State:
- Created 2 years ago
- Reactions:11
- Comments:12 (2 by maintainers)
Top GitHub Comments
No, I switched to next.js.
This is no longer reproducible on latest Nuxt. We now enable vue as an external by default, and dedupe vue in the client build.