Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Aug 7, 2021. It is now read-only.
This repository was archived by the owner on Aug 7, 2021. It is now read-only.

Lazy load dependencies from node_modules #811

Copy link
Copy link
Open
@rosen-vladimirov

Description

@rosen-vladimirov
Issue body actions

Is your feature request related to a problem? Please describe.
vendor.js file contains all dependencies from node_modules. This makes the file really huge and slow for parsing during application startup. When there are lazy modules (in Angular application), it will be great in case we can place all the dependencies that are used in them, but not in the main module, in a separate file(s).

Describe the solution you'd like
The main idea is during application startup to load only modules required for the main module. Everything required for lazy loaded modules, i.e. the actual code of the lazy loaded modules and the dependencies they are using, to be loaded at a later point.

Additional context
I've thought about some ways to handle this and here are my suggestions:

  • Create a lazy_vendor.js and place all node_modules that are not used in the entry point inside it. This module will have to be "required" in all lazy routes.
  • In each lazy loaded module include all of the node_modules that it needs, this way some of the dependencies will be duplicated, which will probably cause other issues.
  • Create multiple vendor chunks based on the node_modules that are used in different lazy loaded modules. For example in case you have four lazy loaded modules - A, B, C and D and three of them require lodash and nativescript-facebook for example, create vendor_smth.js which includes lodash and nativescript-facebook. NOTE: This solutions seems error-prone and may lead to lot of vendor_ chunks created in the application.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.