Skip to content

make tslib imports shakable #16999

@tommytroylin

Description

@tommytroylin

TypeScript Version: 2.4.1
when I use ts with config like:

{
  "compilerOptions": {
    "experimentalDecorators": true,
    "importHelpers": true,
    "module": "esnext",
    "noEmitHelpers": true,
    "target": "esnext"
  }
}

I notice that it come out with code like this

import * as tslib_1 from "tslib";

It is not good enough for tree-shaking by webpack.
Webpack actually bundle with the entire tslib.es6.js

And it's a bit heavy in my bundle
image

Expected behavior:

import { __decorate } from "tslib"; 
// depends on funcitons that actually used with in this file

Metadata

Metadata

Assignees

Labels

CommittedThe team has roadmapped this issueSuggestionAn idea for TypeScript

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions