@dan_abramov @mjackson Possibly! take a look at this https://t.co/egtejpMQDW. It's server middleware that resolves a module graph at request time and generates modulepreload link relations.
@cramforce@jacobrask@jacobsenscott@dbackeus A build isn’t required, just server middleware. Though you could also include it as part of a static HTML build to negate that requirement.
@cramforce@jacobrask@jacobsenscott@dbackeus Definitely, but I believe both those issues can be solved without requiring bundling. Nested dependencies do cause request waterfalls, however I have found a potential solution to that without bundling, but I haven’t tested it in the wild yet.
@cramforce@jacobrask@jacobsenscott@dbackeus There are constraints but there are so many benefits and comparatively little downsides that there’s no question that it’s the right solution. For an excellent explanation see: https://t.co/EuOUOTH66g
@jacobrask@cramforce@jacobsenscott@dbackeus This is the real problem. Packages shouldn’t be published assuming they’re going to be tree shaken and bundled. The irony is they can be published in a way to support no bundling and bundlers will also work perfectly fine, actually they’ll have far less work to do.
@dhh Related: I've just released a tool that will prevent request waterfalls for JavaScript modules https://t.co/egtejpMQDW. It generates modulepreload link relations based on a files module graph. Deeply imported modules will now load in parallel.
@tehmhithorphe@dhh@remix_run Remix does use modulepreload, but for preloading chunks of the built application. This provides references to the graph unique to each module.
@AwokeKnowing@dhh Just feed it the path to a module and it will resolve the module graph as an array. This can then be transformed into modulepreload link relationships for the HTTP Link header. Or for `link` elements, which could potentially be done as part of a build process for a static app.