Skip to content

Tslib 2.0 changes#17759

Merged
filipesilva merged 3 commits intoangular:masterfrom
alan-agius4:tslib-2.0-changes
May 20, 2020
Merged

Tslib 2.0 changes#17759
filipesilva merged 3 commits intoangular:masterfrom
alan-agius4:tslib-2.0-changes

Conversation

@alan-agius4
Copy link
Copy Markdown
Collaborator

See individual commits.

@alan-agius4 alan-agius4 added the target: major This PR is targeted for the next major release label May 19, 2020
Comment thread packages/schematics/angular/migrations/migration-collection.json
@alan-agius4 alan-agius4 requested a review from clydin May 19, 2020 12:28
Comment thread tests/legacy-cli/e2e/tests/build/material.ts Outdated
Comment thread tests/legacy-cli/e2e/tests/misc/debupe-duplicate-modules.ts
@alan-agius4 alan-agius4 requested a review from clydin May 19, 2020 17:40
Copy link
Copy Markdown
Contributor

@IgorMinar IgorMinar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks roughly right to me, but I'll defer to @clydin on this one. thanks @alan-agius4 for putting this together.

@alan-agius4 alan-agius4 added the action: merge The PR is ready for merge by the caretaker label May 20, 2020
Webpack relies on package managers to do module hoisting and doesn't have any deduping logic since version 4.

However relaying on package manager has a number of short comings, such as when having the same library with the same version laid out in different parts of the node_modules tree.

Example:
```
/node_modules/tslib@2.0.0
/node_modules/library-1/node_modules/tslib@1.0.0
/node_modules/library-2/node_modules/tslib@1.0.0
```

In the above case, in the final bundle we'll end up with 3 versions of tslib instead of 2, even though 2 of the modules are identical.

Webpack has an open issue for this webpack/webpack#5593 (Duplicate modules - NOT solvable by `npm dedupe`)

With this change we add a custom resolve plugin that dedupes modules with the same name and versions that are laid out in different parts of the node_modules tree.
TypeScript 3.9 requires tslib 2.0.0, with this change we;
- Update tslib existing and new workspaces to use tslib 2.0.0
- Update new and existing libraries to use tslib 2.0.0 as a direct depedency.

Tslib version is bound to the TypeScript version used to compile the library. Thus, we shouldn't list `tslib` as a `peerDependencies`. This is because, a user can install libraries which have been compiled with older versions of TypeScript and thus require multiple `tslib` versions to be installed.

Closes: #17753

Reference: TOOL-1374
@filipesilva filipesilva merged commit 3b06ad3 into angular:master May 20, 2020
@alan-agius4 alan-agius4 deleted the tslib-2.0-changes branch May 20, 2020 11:00
@angular-automatic-lock-bot
Copy link
Copy Markdown

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jun 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker target: major This PR is targeted for the next major release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants