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

131
Visualizações
Webpack thinks classes in unused code are distinct

I have a class Vec2 which is used throughout my project. The function getBoundingBox() is unused:

let x = new Vec2();
export function getBoundingBox( prims, padding ) {
    let min = new Vec2( null, null );

when I run webpack (config below), every instance of Vec2 in the collated file is replaced by Vec2_Vec2, while the unused call in getBoundingBox() remains as Vec2, like so:

let x = new Vec2_Vec2();
export function getBoundingBox( prims, padding ) {
    let min = new Vec2( null, null );

The obvious fix is to remove the unused code, but I am curious if there is an option to automatically ignore unused code and not include it in the final output. My webpack config is below:

webpack 5.46.0
webpack-cli 4.7.2

{
  entry: {
    app: './build/app.js',
  },
  output: {
    filename: '[name].js',
    path: path.resolve('.', 'dist'),
  },
  devtool: 'inline-source-map',
  optimization: {
    minimize: false,
  },
}
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