Cannot find module ‘./index.less‘ or its corresponding type declarations
现象
原因分析
这个错误只和typescript有关系,是由于ts默认情况下不认识less文件。
解决办法
步骤一
在根目录下创建externals.d.ts
文件,并填写入以下内容:
declare module '*.less' {const resource: {[key: string]: string};export = resource;
}
步骤二
然后,在根目录中找到tsconfig.json
文件,在includes里添加刚刚创建的externals.d.ts
文件的路径:
// tsconfig.json
{compilerOptions: {...}includes: ['./externals.d.ts']
}
保存后,VSCODE编译器自动解析,OK,不再下滑红线警告了
Cannot find module ‘./index.less‘ or its corresponding type declarations相关推荐
- webstorm报错:TS2307: Cannot find module ‘./App.vue‘ or its corresponding type declarations
错误描述 在使用ts后,webstrom报以下错误 TS2307: Cannot find module './App.vue' or its corresponding type declarati ...
- Cannot find module ‘axios;‘ or its corresponding type declarations.ts(2307)
问题描述 我在ts文件中导入刚才安装好的axios,报错了,报错信息如下: 解决方法 按下键盘ctrl+shift+p,在弹出的窗口输入 typescript 选择Select TypeScript ...
- 【VSCode - Vetur 插件报错】Cannot find module ‘XXX‘ or its corresponding type declarations.Vetur(2307)
Cannot find module '@/utils/request' or its corresponding type declarations.Vetur... 原因分析 解决方案 原因分析 ...
- vue+ts项目中import图片时报错Cannot find module ‘xxx‘ or its corresponding type declarations
TS项目中import图片时报错Cannot find module 'xxx' or its corresponding type declarations 在vue+ts项目中使用import的形 ...
- vue3 setup + ts + vite 项目问题解决:Cannot find module ... or its corresponding type declarations.(ts2307)
昨日我尝试使用vue3 setup + ts + vite进行vue3项目的实现,遇到此问题: Cannot find module ... or its corresponding type dec ...
- TS2307: Cannot find module ‘@/assets/home/banner1.webp‘ or its corresponding type declarations.
最近在用typescript + webpack 重构项目,每次打包都会出现下面报错: 第一次以为是这个路径别名的问题,改为相对路径还是报错 尝试过把项目中使用这段图片路径的img标签注释掉,重新打包 ...
- Cannot find module ‘echarts‘ or its corresponding type declarations.
Vue3+ts 在引入echarts会报错 Cannot find module 'echarts' or its corresponding type declarations. 先npm i @t ...
- Cannot find module ... or its corresponding type declarations.(ts2307)
vue3+ts项目出现这样的编译提示,红色下划线 Cannot find module ... or its corresponding type declarations.(ts2307) 解决方法 ...
- 安装vite框架,报错“Cannot find module ‘./App.vue‘ or its corresponding type declaration” 问题解决方法
代码编辑器:vscode ,使用vue3,所以安装了 Volar 插件,可以使 vue 代码高亮显示,不同颜色区分代码块,以及语法错误提示等 提示:如果使用的是vue2,则使用 Vetur 插件:使用 ...
最新文章
- 深入浅出Java垃圾回收机制
- Rhel6服务器时间任务浅谈
- mysql 5.6 emoji_让MySQL支持Emoji表情 mysql 5.6
- linux 启动rabbitmq 报错:
- thymeleaf依赖_玩转SpringBoot集成 Thymeleaf 模版引擎
- 小程序 bindtouchmove 使用拖动按钮 页面跟着滑动并拖动卡顿感 问题
- SpringBoot—Entity父子类表@Inheritance和@MappedSuperclass
- redis入门——安装篇
- 怎么将layui导入php中,layui怎么导入Excel
- Rabbit MQ 配置
- [设计模式-行为型]迭代器模式(Iterator)
- Lync Server 2010企业版系列PART1:基础构建
- UE4 VR中一种比较清晰的UI制作方式
- c ++ strstr_在C / C ++中使用strstr()的指南
- 51Nod - 1051(思维)
- HDU 2549 壮志难酬
- 安卓智能手机完全装机手册,让安卓拥有无限可能!
- HTTP/HTTPS/SOCKS5协议的区别
- 多拨测试软件,openwrt一线多拨网速叠加操作(网友提供)测试速度请用的方式不要用360那些测试软件...
- ssm框架体检管理系统源码+文档