bridge icon indicating copy to clipboard operation
bridge copied to clipboard

Error in using Element-ui without client-only tag

Open suary opened this issue 3 years ago • 2 comments

Environment

- Operating System: `Darwin`
- Node Version:     `v16.15.0`
- Nuxt Version:     `2.16.0-27358576.777a4b7f`
- Package Manager:  `[email protected]`
- Builder:          `webpack`
- User Config:      `render`, `css`, `plugins`, `build`, `alias`, `bridge`, `buildModules`
- Runtime Modules:  `-`
- Build Modules:    `@nuxt/[email protected]`

Reproduction

sandbox please download code and run yarn buildstart or run nuxi build and nuxi preview

Describe the bug

When I use element-ui plugin without client mode:

if I run nuxi build && nuxi preview ,after I open localhost:3000 Terminal will throw error: [nuxt] [request error] document is not defined at Object.<anonymous> (./.output/server/node_modules/element-ui/lib/utils/types.js:39:165) at Module._compile (node:internal/modules/cjs/loader:1105:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10) at Module.load (node:internal/modules/cjs/loader:981:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12) at Module.require (node:internal/modules/cjs/loader:1005:19) at require (node:internal/modules/cjs/helpers:102:18) at Object.<anonymous> (./.output/server/node_modules/element-ui/lib/utils/util.js:19:14) at Module._compile (node:internal/modules/cjs/loader:1105:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)

nuxi dev is ok

And when I use element-ui plugin in client mode,I need to put all element-ui component in client-only tag , but in Nuxt2 , I can use it without client mode ,all element-ui components I have Used supports ssr good in Nuxt2

Additional context

why it's ok in nuxi dev but throw error in nuxi preview?

Logs

No response

suary avatar May 18 '22 02:05 suary

same issue

Ttou avatar Feb 05 '24 08:02 Ttou

repo: https://github.com/Ttou/nuxt-element-issue playground: https://stackblitz.com/~/github.com/Ttou/nuxt-element-issue

image

Ttou avatar Feb 05 '24 08:02 Ttou