Skip to content

Refactor router part. dynamic import router components for up development experience and reduce library volume #424

@HuberTRoy

Description

@HuberTRoy

The components should be import just when user access them.

Problems & Solves:

  1. All components will be load when user access one of those pages.

Use react lazy for router components.

  1. router part does not in one file, the code logic maybe split-up.

Create router folder for manage router, move utils/route.ts to router/router.ts.

Export both components and path, use loop instead of manually add new route.

Now:

Static import all components on the entry file.

4.1Mb size will be transfer in the first access.

Router components and router path split on the different file.

Expect:

Use dynamic import replace static import for router components and the components that not be used immediately.

All router logic code in router folder.

1Mb size for necessary base library, other pages load when user access or pre-fetch on idle time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions