Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error reported after introducing antdv through vite-ssr [server rendering] #16

Open
lita-jerry opened this issue Jun 23, 2022 · 0 comments

Comments

@lita-jerry
Copy link

vueComponent/ant-design-vue#5740
I have submitted at antdv

Version
3.2.6

Environment
"vue": "^3.2.37" "vite-ssr": "^0.9.0" "ant-design-vue": "^3.2.7"

Reproduction link
https://github.com/frandiox/vitesse-ssr-template

Steps to reproduce
依次执行:
pnpm i
npm run dev // 此时报错
npm run dev:spa // 正常运行且渲染antdv组件成功

What is expected?
服务器渲染通过

What is actually happening?
报错,补充说明中贴出报错信息

jerry@JerrydeMacBook-Pro vitesse-ssr-template % npm run dev

dev
vite-ssr --port 3333 --open

vite v2.3.3 dev server running at:

Local: http://localhost:3333/
Network: use --host to expose

-- SSR mode

[@vue/compiler-sfc] <script setup> is still an experimental proposal.
Follow its status at vuejs/rfcs#227.

[@vue/compiler-sfc] When using experimental features,
it is recommended to pin your vue dependencies to exact versions to avoid breakage.

-- getPageProps path=%2F&name=index&client=false
下午4:35:08 [vite] Error when evaluating SSR module /src/components/Header.vue:
/Users/jerry/Desktop/Project/vitesse-ssr-template/node_modules/.pnpm/ant-design-vue@3.2.7_vue@3.2.37/node_modules/ant-design-vue/es/index.js:1
import * as components from './components';
^^^^^^

SyntaxError: Cannot use import statement outside a module
at wrapSafe (internal/modules/cjs/loader.js:984:16)
at Module._compile (internal/modules/cjs/loader.js:1032:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
at Module.load (internal/modules/cjs/loader.js:933:32)
at Function.Module._load (internal/modules/cjs/loader.js:774:14)
at Module.require (internal/modules/cjs/loader.js:957:19)
at require (internal/modules/cjs/helpers.js:88:18)
at nodeRequire (/Users/jerry/Desktop/Project/vitesse-ssr-template/node_modules/.pnpm/vite@2.3.3/node_modules/vite/dist/node/chunks/dep-e9a16784.js:68211:17)
at ssrImport (/Users/jerry/Desktop/Project/vitesse-ssr-template/node_modules/.pnpm/vite@2.3.3/node_modules/vite/dist/node/chunks/dep-e9a16784.js:68164:20)
at eval (/src/components/Header.vue:3:69)
/Users/jerry/Desktop/Project/vitesse-ssr-template/node_modules/.pnpm/ant-design-vue@3.2.7_vue@3.2.37/node_modules/ant-design-vue/es/index.js:1
import * as components from './components';
^^^^^^

SyntaxError: Cannot use import statement outside a module
at wrapSafe (internal/modules/cjs/loader.js:984:16)
at Module._compile (internal/modules/cjs/loader.js:1032:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
at Module.load (internal/modules/cjs/loader.js:933:32)
at Function.Module._load (internal/modules/cjs/loader.js:774:14)
at Module.require (internal/modules/cjs/loader.js:957:19)
at require (internal/modules/cjs/helpers.js:88:18)
at nodeRequire (/Users/jerry/Desktop/Project/vitesse-ssr-template/node_modules/.pnpm/vite@2.3.3/node_modules/vite/dist/node/chunks/dep-e9a16784.js:68211:17)
at ssrImport (/Users/jerry/Desktop/Project/vitesse-ssr-template/node_modules/.pnpm/vite@2.3.3/node_modules/vite/dist/node/chunks/dep-e9a16784.js:68164:20)
at eval (/src/components/Header.vue:3:69)
Error: Couldn't resolve component "default" at "/"
at /Users/jerry/Desktop/Project/vitesse-ssr-template/node_modules/.pnpm/vue-router@4.0.8_vue@3.2.37/node_modules/vue-router/dist/vue-router.cjs.js:2016:47
下午4:35:08 [vite] Internal server error: Couldn't resolve component "default" at "/"
at /Users/jerry/Desktop/Project/vitesse-ssr-template/node_modules/.pnpm/vue-router@4.0.8_vue@3.2.37/node_modules/vue-router/dist/vue-router.cjs.js:2016:47
(node:27390) UnhandledPromiseRejectionWarning: Error: Couldn't resolve component "default" at "/"
at /Users/jerry/Desktop/Project/vitesse-ssr-template/node_modules/.pnpm/vue-router@4.0.8_vue@3.2.37/node_modules/vue-router/dist/vue-router.cjs.js:2016:47
(Use node --trace-warnings ... to show where the warning was created)
(node:27390) 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: 4)
(node:27390) [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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant