使用的WebPack來解決我的進口:的WebPack解決index.whatever.jsx自動
/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']
}
,但沒有解決。是否有可能做我正在尋找的東西?
我試圖將我的組件分離出來放在自己的文件夾中以保持結構清潔。 –