Skip to content

[Feature] Support dynamic requires (imports) in DOM-Router. #2041

@vkryukov76

Description

@vkryukov76

DOM-Router is very useful pattern.

But it has one small flaw - all routes always bundled into one file that loads on every page, even when most routes will never be fired.

Webpack has a great feature called dynamic imports.

Unfortunately current implementation of DOM-Router works only with regular modules, not the dynamic ones.

Dynamic approach to routes can help to split some heavy routes into separate chunks that loads on-demand through only one trigger - a classname of body tag.

I already made some changes in DOM-Router class to support require.ensured and import()ed modules (not supported in current sage's build system now).

vkryukov76@9b41139

If upstream and community will find it useful I will be glad to submit a PR.

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