javascript - webpack 无法解析 d.ts 文件
问题描述
伙计们!
我尝试导入 d.ts 文件,但遇到以下错误:
Field 'browser' doesn't contain a valid alias configuration
我猜,webpack 加载器有点麻烦,所以 webpack 无法处理 d.ts 文件。
"webpack": "^5.27.2",
"webpack-cli": "^4.5.0",
"webpack-dev-server": "^3.11.2",
"webpack-merge": "^5.7.3"
错误:
ERROR in ./node_modules/extypes/typings/index.d.ts 3:0-27
Module not found: Error: Can't resolve './telegram' in 'D:\devprojects\node\changex\crm\node_modules\extypes\typings'
resolve './telegram' in 'D:\devprojects\node\changex\crm\node_modules\extypes\typings'
using description file: D:\devprojects\node\changex\crm\node_modules\extypes\package.json (relative path:
./typings)
Field 'browser' doesn't contain a valid alias configuration
using description file: D:\devprojects\node\changex\crm\node_modules\extypes\package.json (relative path: ./typings/telegram)
no extension
Field 'browser' doesn't contain a valid alias configuration
D:\devprojects\node\changex\crm\node_modules\extypes\typings\telegram doesn't exist
.tsx
Field 'browser' doesn't contain a valid alias configuration
D:\devprojects\node\changex\crm\node_modules\extypes\typings\telegram.tsx doesn't exist
.ts
Field 'browser' doesn't contain a valid alias configuration
D:\devprojects\node\changex\crm\node_modules\extypes\typings\telegram.ts doesn't exist
.js
Field 'browser' doesn't contain a valid alias configuration
D:\devprojects\node\changex\crm\node_modules\extypes\typings\telegram.js doesn't exist
as directory
D:\devprojects\node\changex\crm\node_modules\extypes\typings\telegram doesn't exist
有没有人遇到过这个问题?
解决方案
推荐阅读
- r - 将自定义轴标签添加到多面 ggplot
- r - 在R中的条件下将数据集中的列匹配到另一个
- mongodb - Mongodb查询每个匹配表达式A或表达式B的数组元素
- google-analytics - GA4 的页面加载问题
- auth0 - Auth0 存储用户信息的本地副本
- android - 在 android Kotlin 中设计弯曲的容器/CardViews
- java - 在 JpaRe 上声明的 @EnableJpaRepositories 中定义的 com.user.Repository.UserRepository 中创建名称为“userRepository”的 bean 时出错
- c# - 将值转换为 int
- apache - openshift pod中的网关超时
- flutter - 如何在 Flutter 中使用 Dart 语言获取 android 手机 IMEI 号码?