tleunen/babel-plugin-module-resolver

handle resolving duplicated files

Open

#122 aberto em 13 de fev. de 2017

Ver no GitHub
 (4 comments) (0 reactions) (0 assignees)JavaScript (217 forks)batch import
enhancementhelp wanted

Métricas do repositório

Stars
 (3.417 stars)
Métricas de merge de PR
 (Nenhuma PRs mesclada em 30d)

Description

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>
  }
}

Guia do colaborador