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

168
Visualizações
How to tree-shake dependencies between bundles in webpack?

I'm using webpack to create an electron app so I must use a different target for "preload", "main" and "render" entry points and that's why I have to build 3 different bundles. The problem is that if, lets say, I import an enum from a module used in "main" into "preload" it doesn't just imports the enum but it also imports the whole module when compiling for development and compiling for production is just a bit better since it imports whatever that module imported. Ex:

//main.ts
import * as fs from "fs";

export enum Foo{
Bar
}

//preload.ts
import { Foo } from "./main";

var va = Foo.Bar;

//(compiled for production) preload.ts -> preload.js
const fs = require(fs)
...

As you can see its importing "fs" in preload.js even tough it doesn't use it and just because I'm importing an enum, I haven't tested but I'm sure that this doesn't happen between different entry points with webpack and tree-shaking but only between bundles

So I would like to ask if anyone happens to know a way to only import the needed code, not necessarily related to webpack
Thanks

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