DEV Community

Discussion on: Routing: I’m not smart enough for a SPA

Collapse
 
jon49 profile image
Jon Nyman

Oh, and the on-the-fly imports (dynamic imports) I was talking about I was more talking about doing it in a service worker. Which isn't allowed in service workers yet - but I have created my own, but it is a bit of a pain to do :-) compared to just having it work out of the box.

Thread Thread
 
tigt profile image
Taylor Hunt

Yeah, I reused the Rollup ecosystem’s code for that, myself. Pretty odd that import still isn’t allowed in Service Workers, but at least importScripts() lets us fake it.

Thread Thread
 
jon49 profile image
Jon Nyman

Yeah, actually, I'm looking for specifically dynamic imports so I only need to load the code is only being used at the moment rather than having to load all the pages code at once. So this:

developer.mozilla.org/en-US/docs/W...

For regular imports they work with the latest Chrome as of earlier this year (if I remember right). But Firefox still doesn't have it.

But this discussion has been great. It's made me think of how I can simplify my offline app more using a truer MPA style coding.

Yes, I'm definitely looking forward to your next post! Thank you for putting all the time and effort into these posts!