-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Labels
Description
- I've read the guidelines for Contributing to Roots Projects
- This is a feature request
- This is a bug report
- This request isn't a duplicate of an existing issue
- I've read the docs and NPM Debugging Guidelines post and followed them (if applicable)
- This is not a personal support request that should be posted on the Roots Discourse forums
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).
If upstream and community will find it useful I will be glad to submit a PR.
samrap, ciromattia, Drooooopy, dimanotdemo, Tailzip and 4 moreniklasp