javascript - jsconfig.json 允许在 React 中进行绝对导入,但会破坏 Styleguidist 导入
问题描述
我jsconfig.json
在整个 Create-React-App 中使用绝对导入。有没有办法让 Styleguidist 正确遵守文件定义的绝对导入jsconfig.json
?它在我的 React 应用程序中运行良好,但是当 Styleguidist 解析器尝试读取.js
文件并遇到这些绝对导入之一时,它无法正确定位它。
jsconfig.json
{
"compilerOptions": {
"baseUrl": "src"
}
}
/src/components/Foo.js
import { Bar } from 'components'
Styleguidist 终端:
Module not found: Cant resolve 'components'
/.
+-- styleguide.config.js
+-- src
| +-- /components
| | +-- Foo.js
| | +-- Bar.js
| | +-- index.js
请知道我已尝试将 移动styleguide.config.js
到/src
目录中以在该配置和jsconfig.json
. 它没有解决问题。
解决方案
推荐阅读
- javascript - 为什么在 Ant Design 表单中自定义输入控件无法正确验证?
- sql-server - HIbernate 5 同实体多表
- python - 在python中优化模式匹配
- sql - 将分钟舍入到小时和刻钟 (SQL)
- sql - Django 减少页面 SQL 查询(代码优化)
- revit-api - pyRevit WPF 非模态问题
- azureservicebus - Azure 服务总线异常 - MessageLockLostException:提供的锁无效。锁已过期,或消息已被删除
- angular - Angular 9 使用提供者扩展 ServiceProviderComponent
- go - 无论如何在ansi控制台上打印斜体字体?
- powershell - PowerShell 脚本 - 复制广告成员 o