Skip to content

Improve loaders to use the vendor chunk and reduce their size #12

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

Merged
merged 4 commits into from
May 16, 2018

Conversation

PeterStaev
Copy link
Contributor

Fixes #5.

Instead of child compiling workers (which does not reuse the common chunk and increases worker size) this change makes webpack compile the workers in the main bundle. This way it reuses requires from the vendor chunk. After the compile the plugin extracts each worker module in a separate chunk file and also creates a similar to the starter.js file for every worker.
In order the vendor chunk to be reused inside the workers, any UI related imports need to be excluded for the worker. That's why the starter file for the worker raises a global.__worker flag which is then used in the vendor file to conditionally import the UI modules.

@ns-bot
Copy link

ns-bot commented Mar 18, 2018

Can one of the admins verify this patch?

Copy link
Contributor

@sis0k0 sis0k0 left a comment

Choose a reason for hiding this comment

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

Great work!

@sis0k0 sis0k0 merged commit e227f12 into NativeScript:master May 16, 2018
@PeterStaev PeterStaev deleted the improved-loader branch May 18, 2018 06:20
sis0k0 added a commit that referenced this pull request May 19, 2018
sis0k0 added a commit that referenced this pull request May 19, 2018
…#12)" (#18)

Reverting because of issues when bundling workers that use modules from the vendor chunk.

This reverts commit e227f12.
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

Successfully merging this pull request may close these issues.

3 participants