Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression failure upgrading from 2.5.0 to 2.5.1+, webpack fails to transpile new export statement for ES5. #231

Open
jbalinski opened this issue Nov 29, 2023 · 1 comment

Comments

@jbalinski
Copy link

We are attempting to upgrade to the latest version of tslib but ran into an issue with IE11. We are targeting ["web", "es5"] in our webpack.config.js. We are also have importHelpers set to true in our tsconfig.json. With this configuration IE11 no longer runs in webpack development mode.

It appears that the breaking change was made in tslib 2.5.1. The following export was added to tslib.es6.mjs:

export default {
  __extends,
  __assign,
  __rest,
  __decorate,
  __param,
  __metadata,
  __awaiter,
  __generator,
  __createBinding,
  __exportStar,
  __values,
  __read,
  __spread,
  __spreadArrays,
  __spreadArray,
  __await,
  __asyncGenerator,
  __asyncDelegator,
  __asyncValues,
  __makeTemplateObject,
  __importStar,
  __importDefault,
  __classPrivateFieldGet,
  __classPrivateFieldSet,
  __classPrivateFieldIn,
};

This ES6 style of export is not transpiled by webpack when running in development mode and which causes the issue in IE11. The issue does not occur when running in production mode. One workaround is to manually include the es5 compliant tslib.js file on our pages and take webpack out of the picture.

@jakebailey
Copy link
Member

If you're targeting es5 in your webpack config, then this file should be getting downleveled in syntax by webpack or babel or similar; this file is .mjs after all and is intended to contain ESM syntax like the above. This (to me) sounds like a bug in webpack or an incorrect configuration that isn't downleveling all of the files in a build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants