我用cli 创建的uni-app 工程引入unplugin-auto-import和unplugin-vue-components之后,HBuilder 运行就报这个错,直接命令行run dev:h5 不会报错,是HBuilder 的运行环境有问题吗?需要我怎么改才行
failed to load config from /app-ui/vite.config.ts
10:49:28.796 error when starting dev server:
10:49:28.797 /xxx/app-ui/node_modules/unplugin/dist/index.js:1028
10:49:28.808 setup: ((_a = plugin.esbuild) == null ? void 0 : _a.setup) ?? function setup({ onStart, onEnd, onResolve, onLoad, initialOptions, esbuild: { build: build2 } }) {
10:49:28.808 ^
10:49:28.823 SyntaxError: Unexpected token '?'
10:49:28.834 at wrapSafe (internal/modules/cjs/loader.js:915:16)
10:49:28.834 at Module._compile (internal/modules/cjs/loader.js:963:27)
10:49:28.849 at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
10:49:28.866 at Module.load (internal/modules/cjs/loader.js:863:32)
10:49:28.882 at Function.Module._load (internal/modules/cjs/loader.js:708:14)
10:49:28.883 at Module.require (internal/modules/cjs/loader.js:887:19)
10:49:28.899 at require (internal/modules/cjs/helpers.js:74:18)
10:49:28.916 at Object.<anonymous> (/xxx/app-ui/node_modules/unplugin-auto-import/dist/chunk-BQPAGBJJ.js:6:17)
10:49:28.917 at Module._compile (internal/modules/cjs/loader.js:999:30)
10:49:28.932 at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
4 个回复
DCloud_UNI_WZF
请参考提交bug模板提供详细信息或可复现demo,谢谢!
高级CV
我用cli 创建的uni-app 工程引入unplugin-auto-import和unplugin-vue-components之后,HBuilder 运行就报这个错,直接命令行run dev:h5 不会报错,是HBuilder 的运行环境有问题吗?需要我怎么改才行
failed to load config from /app-ui/vite.config.ts
10:49:28.796 error when starting dev server:
10:49:28.797 /xxx/app-ui/node_modules/unplugin/dist/index.js:1028
10:49:28.808 setup: ((_a = plugin.esbuild) == null ? void 0 : _a.setup) ?? function setup({ onStart, onEnd, onResolve, onLoad, initialOptions, esbuild: { build: build2 } }) {
10:49:28.808 ^
10:49:28.823 SyntaxError: Unexpected token '?'
10:49:28.834 at wrapSafe (internal/modules/cjs/loader.js:915:16)
10:49:28.834 at Module._compile (internal/modules/cjs/loader.js:963:27)
10:49:28.849 at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
10:49:28.866 at Module.load (internal/modules/cjs/loader.js:863:32)
10:49:28.882 at Function.Module._load (internal/modules/cjs/loader.js:708:14)
10:49:28.883 at Module.require (internal/modules/cjs/loader.js:887:19)
10:49:28.899 at require (internal/modules/cjs/helpers.js:74:18)
10:49:28.916 at Object.<anonymous> (/xxx/app-ui/node_modules/unplugin-auto-import/dist/chunk-BQPAGBJJ.js:6:17)
10:49:28.917 at Module._compile (internal/modules/cjs/loader.js:999:30)
10:49:28.932 at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
enderX (作者)
所以为啥要用 HBuilderX 呢
2022-08-02 11:57
高级CV
回复 enderX: 要用云函数做推送
2022-08-02 13:29
enderX (作者)
回复 高级CV: 所以,得益于 unplugin-auto-import 和 unplugin-vue-components 两个插件而不需要引入的 vue 和你用的某个组件库的相关 api/组件, 在 HBuilder 环境下能正常使用吗?我觉得不能,并应该有错误抛出
2022-08-02 13:38
l***@163.com
同求该问题
1***@qq.com
这个解决了吗
enderX (作者)
新版本应该没有这类问题了吧?
2024-09-20 16:26
1***@qq.com
回复 enderX: 官方下载的cli还是有,你下载的没有吗
2024-09-21 16:28
enderX (作者)
回复 1***@qq.com: 可以试试给 auto-import.d.ts 增加@ts-nocheck 注解、升级最新的typescript依赖,看看能不能解决
2024-09-25 11:02