【发布时间】:2017-10-22 17:05:27
【问题描述】:
当使用 webpack 解析我的导入时:
/component/thing/index.jsx
/component/stuff/index.jsx
可以像这样导入
import Thing from './component/thing';
import Stuff from './component/stuff';
因为 index.jsx 是自动解析的。问题是现在我的项目中有大量名为 index.jsx 的文件,这使得搜索文件变得困难且烦人。有没有办法配置 webpack 接受类似的东西:
/component/thing/thing.index.jsx
/component/stuff/stuff.index.jsx
但仍允许像上面这样的速记导入?
我的第一直觉是(在 Webpack 中):
resolve: {
extensions: ['.index.jsx']
}
但这并没有解决。是否有可能做我正在寻找的事情?
【问题讨论】:
标签: reactjs module webpack components jsx