Could not xxx file for module ‘module-name‘. ‘xxx/module-name.js‘ implicitly has an ‘any‘ type

如果可以实现记得点赞分享,谢谢老铁~

1.需求描述

在vue3.0 + vite + typeScript 开发中,需要引入第三方js脚本作为插件使用,但yarn build 构建的时候一直报此错误。

2.使用场景

在vue项目中使用第三方库作用组件库,因为没有配置相关参数,导致构建一直报错。

3.解决思路

在tsconfig.json中加入下面红色标注的一行配置即可。

“noImplicitAny”: false

// tsconfig.json

{
    
    
  "compileOnSave": false,
  "compilerOptions": {
    
    
    ........
    "noImplicitAny": false,
  },
.....
}

猜你喜欢

转载自blog.csdn.net/Gas_station/article/details/131005933
今日推荐