IMA.js Babel 6 Polyfill

raw JSON →
0.12.0 verified Sat Apr 25 auth: no javascript maintenance

Provides a polyfill for IE9 and IE10 to fix super-constructor calls in the Babel 6 runtime, addressing transpilation issues that affect applications using Babel 6 class inheritance on legacy Internet Explorer versions. Version 0.12.0 is the latest stable release, but the package is in maintenance mode and not actively developed. It is part of the IMA.js ecosystem and intended for use with IMA.js applications, though it can be used as a standalone fix. Alternatives include using Babel 7's @babel/polyfill or core-js for broader IE support.

error ReferenceError: Super constructor may not be called in IE9/10
cause Babel 6 transpiles super() calls incorrectly for IE9 and IE10.
fix
Import ima-babel6-polyfill as the first line of your application entry point.
error polyfill is not a function
cause Trying to use the polyfill as a function or assign its result.
fix
Use bare import or require: import 'ima-babel6-polyfill';
deprecated Babel 6 is outdated and no longer supported. Consider migrating to Babel 7+.
fix Upgrade to Babel 7 and use @babel/polyfill or core-js.
gotcha This polyfill only fixes super-constructor calls for IE9 and IE10. It does not cover other Babel 6 polyfills or features.
fix For full polyfill support, consider using @babel/polyfill or core-js with appropriate config.
gotcha Since the package has no exports, importing it in a way that expects a value will return undefined.
fix Use bare import (import '...') or bare require (require('...')).
npm install ima-babel6-polyfill
yarn add ima-babel6-polyfill
pnpm add ima-babel6-polyfill

Shows how to import the polyfill and verifies that super constructor works in IE9/10.

// Ensure this is imported before any other code
import 'ima-babel6-polyfill';

class Parent {
  constructor() {
    this.x = 1;
  }
}

class Child extends Parent {
  constructor() {
    super();
    this.y = 2;
  }
}

const child = new Child();
console.log(child.x); // Should log 1 in IE9/10 with polyfill