tleunen/babel-plugin-module-resolver

handle resolving duplicated files

开放

#122 创建于 2017年2月13日

 (4 条评论) (0 个反应) (0 位负责人)JavaScript (217 个派生)batch import
enhancementhelp wanted

仓库指标

星标
 (3,417 个星标)
PR 合并指标
 (30 天内没有已合并 PR)

描述

I have these two files

app/component/home/Trader.js

app/component/contact/Trader.js

Now I import that second Trader in this component app/component/sent/Sent.js

import Trader from 'Trader'
export default class Sent extends React.Component{
  render(){ 
    return <div>hello <Trader /></div>
  }
}

Problem: I will have the first trader file instead second one.

I understand that babel will resolve as soon as it find a match. However, I think we can do a warning. If babel found case like this. Give a warning, then users will know they have to change the file name in the import. They can change to something like below

import Trader from 'contact/Trader'
export default class Sent extends React.Component{
  render(){ 
    return <div>hello <Trader /></div>
  }
}

贡献者指南