Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

254
Vistas
Babel-loader: Preset that contains other presets is not being loaded correctly

I have a Babel config, that (roughly) looks like the following:

module.exports = function () {
  return {
    presets: [
      [
        require.resolve('@babel/preset-env'),
        { /* options */ },
      ]
    ],
    plugins: [ /* misc plugins */ ], 
  }
}

This is well and fine, and works great when used on it's own.

However, what I'd like to do is be able to use this as a preset, and add in additional plugins or presets on top. For example:

.babelrc

{
  presets: ['my-preset'],
  plugins: [ /* additional plugins */ ], 
}

The issue that I'm running into is that babel-loader seemingly doesn't resolve these "nested" presets. Syntax that should be transformed by @babel/preset-env no longer does, leading me to believe it's never used, though it should be transitively included.

If the lack of require.resolve in the .babelrc looks concerning, my Webpack config handles this automatically. Using that .babelrc, my Babel loader options looks like:

{
  presets: [ '/home/user/Projects/project/node_modules/my-preset/index.js' ]
}

According to the Babel docs, presets absolutely can include other presets so I'm not sure what the issue is here, or even how to debug. A console.log in my babel config before the return does show up in the build logs, so it is loaded to some degree, but why @babel/preset-env doesn't then work is beyond me.

Using Webpack v4.38.0, babel-loader v8.2.2

about 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda