vue build报错:Could not find a declaration file for module '../package/dist/vue-web-component-wrapper.es.js'. /package/dist/vue-web-component-wrapper.es.js' implicitly has an 'any' type

分类:Javascript| 发布:camnpr| 查看: | 发表时间:2024/1/13

 D:\Camnpr git:[dev]

npm run build

> vite1@1.0.0 build

> pnpm run type-check && pnpm run build-only

> vite1@1.0.0 type-check D:\Camnpr 

> vue-tsc --noEmit

src/main.ts:10:33 - error TS7016: Could not find a declaration file for module '../package/dist/vue-web-component-wrapper.es.js'. 'D:/Camnpr/package/dist/vue-web-component-wrapper.es.js' implicitly has an 'any' type.

10 import createWebComponent  from '../package/dist/vue-web-component-wrapper.es.js'

                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Found 1 error in src/main.ts:10

 ELIFECYCLE  Command failed with exit code 2.

 

解决方案:

在tsconfig.json文件中添加配置:

 

"noImplicitAny": false,
"allowJs": true

配置后,使用import "xxx" from "xxx" 语句也不会报错了。

原创文章如转载,请注明:转载自郑州网建-前端开发 http://camnpr.com/
本文链接:http://camnpr.com/javascript/2296.html