microsoft / microsoft/tslib

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

Open
#231 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
1.3k
Forks
145
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with webpack.config.js and tsconfig.json, then inspect the export in tslib.es6.mjs. Reproduce the development-mode bundle targeting web and es5, and verify that the resulting bundle runs in IE11 without manually including tslib.js.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, webpack
Domain
build-system, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.