Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

227
Visualizações
How does an import from node_modules really work in ReactJS?

I installed react-vis via npm install react-vis and its possible to write import { XYPlot, LineSeries } from 'react-vis';

I want to know how the systems knows where XYPlot and LineSeries are? I looked in the node_modules directory and there is no index.js.

The structure of the react-vis directory is the following

my-app/
├─ node_modules/
│  ├─ react-vis/
│  │  ├─ dist/
│  │  ├─ es/
│  │  ├─ CHANGELOG.md
│  │  ├─ LICENSE
│  │  ├─ package.json
│  │  ├─ README.md

How does this work? I researched and for example this does not helped me: Where { component } from 'react' is located when we are importing ReactJS?

Edit I think it looks in the package.json that is inside the react-vis directory. There are two entries that look interesting. "name": "dist" and "module": "es". I think that i have to look inside the dist directory. Inside the dist directory, there is an index.js file. I open this file and on line 318 it says exports.XYPlot = _xyPlot2.default;

In the es folder inside the index.js there is on line 98 this: export { _XYPlot as XYPlot }; I don't know if this is important.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda