Skip to content

Named tslib imports cause webpack bundle size increase #33035

@MLoughry

Description

@MLoughry

TypeScript Version: 3.6.1-rc

Search Terms:
tslib

Expected behavior:
#32742, which changes all tslib imports from namespace imports to named imports, would have decreased bundle size in webpack builds from typescript code

Actual behavior:
Due to a quirky workaround in webpack, all function invocations of named harmony imports are wrapped in an Object() constructor; as a result, #32742 actually increases bundle size (to the tune of ~9kB in Outlook Web boot bundles)

Since the PR was an attempt specifically to help webpack, and @sokra claims that tree-shaking works even with namespace imports, I think the change should be reverted.

Related Issues:
webpack/webpack#9615

Metadata

Metadata

Assignees

No one assigned

    Labels

    Not a DefectThis behavior is one of several equally-correct options

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions