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

191
Visualizações
Choosing selective ES features to be processed by webpack when using electron-renderer target

I am using webpack to generate the bundle for frontend/UI code. I am using react as a frontend library. I understand that webpack uses loaders to process different content it encounters in the source. If it has a loader for something it will know what to do with it. In this case the babel-loader and @babel/preset-react are being used @babel-preset/env to tell webpack what do do with new es features and the JSX. Now here is my problem:

Since I am using electron it already has many of the great features like arrow functions, spread operator, async/await and much more and even though webpack is provided the target electron-renderer it still does not know that it doesnt need to commpile these things to equivalent code that does not need compiling in the given environemnt.

How do I avoid this unnecessary transpilation. For reference here is my webpack config.

const path = require('path');

module.exports = {
  entry: './renderer/index.js',
  target: 'electron-renderer',
  output: {
    path: path.resolve(__dirname, 'build'),
    filename: 'bundle.js',
  },
  module: {
    rules: [
      {
        test: /\.js$/,
        include: path.resolve(__dirname, 'renderer'),
        use: {
          loader: 'babel-loader',
          options: {
            presets: ['@babel/preset-env', '@babel/preset-react'],
          },
        },
      },
    ],
  },
  devtool : false,
  resolve: {
    extensions: ['.js'],
  },
};
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