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

121
Visualizações
How to bundle a collection of React components so that they can be imported with a create-react-app app?

I am using create-react-app to create an initial project which needs to import custom React components from a separate node package.

I tried having the React app import a component from the package but this shows an error message stating that it could not transpile scripts from inside node_modules. It seems that it's necessary to pre-process and bundle the JSX syntax.

How can I configure browserify/babel/babelify to bundle the series of components so that the exports are recognised by the app?

import { Panel } from "components-module/react";

The IntelliSense picks up the component imports in VS Code but in the browser console the react app shows an error stating that the react component is undefined and suggests that the module lacks the export statements.

In the Babel configuration I tried setting modules: false under @babel/preset-env to preserve ES6 module syntax in the bundle but this leads to a different error (this time when bundling):

ParseError: 'import' and 'export' may appear only with 'sourceType: module'
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