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

361
Vistas
What is @babel/plugin-transform-classes?

I run Google PageSpeed Insights on my site, and it reports an issue that is "Avoid serving legacy JavaScript to modern browsers", as below:

enter image description here

I have no idea of what is @babel/plugin-transform-classes, so I search online and it seems babel is a JavaScript compiler and @babel/plugin-transform-classes is a plugin.

But I don't know or install the compiler and the plugin, why there will be such an issue?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Short answer

  • A babel plugin that fix some Javascript errors for legacy browser
  • You cannot fix this error on your own, not if you're using Wordpress or any framework at least.

Long answer

What is babel

Babel is a JavaScript compiler which is used by framework to make code understandable for older browser.

What is @babel/plugin-transform-classes

This is a babel plugin, which is included in @babel/preset-env.

It does

  • Transpiles classes using SuperClass.apply(/* ... */), but native classes aren't callable and thus throw in this case.
  • Some built-in functions (like Array) always return a new object. Instead of returning it, Babel should treat it as the new this.

In

class Test {
  constructor(name) {
    this.name = name;
  }

  logger() {
    console.log("Hello", this.name);
  }
}

Out

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

var Test = (function() {
  function Test(name) {
    _classCallCheck(this, Test);

    this.name = name;
  }

  Test.prototype.logger = function logger() {
    console.log("Hello", this.name);
  };

  return Test;
})();

Can I fix this problem on my own?

No, since a lot of library are still using babel, you'll have to wait for them to move on.

So you're safe to ignore this issue.

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