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

pnpm run dev:h5:ssr 报错 #22

Open
350469960 opened this issue Mar 29, 2023 · 5 comments
Open

pnpm run dev:h5:ssr 报错 #22

350469960 opened this issue Mar 29, 2023 · 5 comments
Labels
help wanted Extra attention is needed

Comments

@350469960
Copy link

350469960 commented Mar 29, 2023

一、错误信息如下:

/Users/xunwu/docod/test/uni-vue3-ts-template/node_modules/.pnpm/[email protected]/node_modules/vk-uview-ui/index.js:2
import mixin from './libs/mixin/mixin.js'
^^^^^^

SyntaxError: Cannot use import statement outside a module
at wrapSafe (internal/modules/cjs/loader.js:1001:16)
at Module._compile (internal/modules/cjs/loader.js:1049:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:12)
at ModuleWrap. (internal/modules/esm/translators.js:199:29)
at ModuleJob.run (internal/modules/esm/module_job.js:183:25)
at async Loader.import (internal/modules/esm/loader.js:178:24)
at async nodeImport (file:///Users/xunwu/docod/test/uni-vue3-ts-template/node_modules/.pnpm/[email protected]_ppdxls77r7tfsxvxidunrbldv4/node_modules/vite/dist/node/chunks/dep-51c4f80a.js:53132:21)
at async eval (/src/main.ts:9:31)
at async instantiateModule (file:///Users/xunwu/docod/test/uni-vue3-ts-template/node_modules/.pnpm/[email protected]_ppdxls77r7tfsxvxidunrbldv4/node_modules/vite/dist/node/chunks/dep-51c4f80a.js:53053:9)

二、如果package.js加入"type":"module",则报如下错误:

failed to load config from /Users/xunwu/docod/test/uni-vue3-ts-template/vite.config.ts

error when starting dev server:
TypeError: uni is not a function
at file:///Users/xunwu/docod/test/uni-vue3-ts-template/vite.config.ts.timestamp-1680072557068.mjs:9:5
at ModuleJob.run (internal/modules/esm/module_job.js:183:25)
at async Loader.import (internal/modules/esm/loader.js:178:24)
at async loadConfigFromBundledFile (file:///Users/xunwu/docod/test/uni-vue3-ts-template/node_modules/.pnpm/[email protected]_ppdxls77r7tfsxvxidunrbldv4/node_modules/vite/dist/node/chunks/dep-51c4f80a.js:62827:21)
at async loadConfigFromFile (file:///Users/xunwu/docod/test/uni-vue3-ts-template/node_modules/.pnpm/[email protected]_ppdxls77r7tfsxvxidunrbldv4/node_modules/vite/dist/node/chunks/dep-51c4f80a.js:62712:28)
at async resolveConfig (file:///Users/xunwu/docod/test/uni-vue3-ts-template/node_modules/.pnpm/[email protected]_ppdxls77r7tfsxvxidunrbldv4/node_modules/vite/dist/node/chunks/dep-51c4f80a.js:62336:28)
at async Module.createServer (file:///Users/xunwu/docod/test/uni-vue3-ts-template/node_modules/.pnpm/[email protected]_ppdxls77r7tfsxvxidunrbldv4/node_modules/vite/dist/node/chunks/dep-51c4f80a.js:61636:20)
at async createSSRServer (/Users/xunwu/docod/test/uni-vue3-ts-template/node_modules/.pnpm/@dcloudio[email protected][email protected][email protected]/node_modules/@dcloudio/vite-plugin-uni/dist/cli/server.js:42:18)
at async CAC.runDev (/Users/xunwu/docod/test/uni-vue3-ts-template/node_modules/.pnpm/@dcloudio[email protected][email protected][email protected]/node_modules/@dcloudio/vite-plugin-uni/dist/cli/action.js:22:28)
 ELIFECYCLE  Command failed with exit code 1.


 三、本地环境
 node: v14.19.3
 pnpm: 7.26.3

@ATQQ
Copy link
Owner

ATQQ commented Mar 29, 2023

get 晚点看一下。。。

应该是这个vk-uview-ui 包有些问题 ,如果不用这个组件库的话可以先将相关代码移除

@ATQQ
Copy link
Owner

ATQQ commented Mar 29, 2023

解法肯定不是 加 type:"module"

@350469960
Copy link
Author

好的,以前其他人提的换成tumi 组件库的有集成好吗?

@ATQQ
Copy link
Owner

ATQQ commented Mar 29, 2023

这个没有,如需要可以先自行按照相关文档接入 uni组件库这块不太好找个大而全 接入简单,又多端兼容的 😄

@ATQQ ATQQ added the help wanted Extra attention is needed label Mar 30, 2023
@ATQQ
Copy link
Owner

ATQQ commented Sep 17, 2023

最近才有空看这个问题 ,目测应该是 这个组件库不支持SSR 具体我再抽时间看一下 找个可替代的,我先在文档里移除一下SSR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants