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

197
Visualizações
Typescript react esbuild unable to build

I want to build a package and upload it to npm so I tried to create a demo package first. I used this repo as a starter package: https://github.com/wobsoriano/vite-react-tailwind-starter

and updated the build script to this

  "build-test": "esbuild src/App.tsx --bundle --minify  --outfile=src/dist/index.js",

and the App.tsx i updated to this

import React from "react";
import "./index.css";

const App = () => {
  return <div>My Dummy</div>;
};

export default App;

Then I tried to build it and import it in my main.tsx like this:

import React from "react";
import ReactDOM from "react-dom";
import App from "./dist/index.js";

ReactDOM.render(
  <React.StrictMode>
    <App />
  </React.StrictMode>,
  document.getElementById("root")
);

And then I get this error:

The requested module '/src/dist/index.js' does not provide an export named 'default

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

I only can give you a quick manual fix. For some reason the index.js file has no "export default" keywords, but you can open the src\dist\index.js file and you can just insert the "export default " at the very begin. So the begin will look like this:

export default ()=>{var K=Object.create;var _=Object.define.

Because the whole index.js just a function, you can do this.

about 4 years ago · Juan Pablo Isaza Relatório
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