cyc icon indicating copy to clipboard operation
cyc copied to clipboard

Wepack loaders in mvi.js

Open abaco opened this issue 10 years ago • 5 comments

I think it would be nice to be able to use webpack loaders in mvi.js, to do things like require('style.css'). This is currently not possible because the server loads mvi.js directly. Only the client-side bundle.js is produced by webpack.

An additional bundle for the server side would be needed for this to work. Would you consider a pull request?

abaco avatar Dec 11 '15 15:12 abaco

Sure, contributions are appreciated!

Sorry for the delay, school's been busy.

alkhe avatar Dec 18 '15 14:12 alkhe

Cool, I'll try to find time for this.

abaco avatar Dec 18 '15 15:12 abaco

Any progress on this?

alkhe avatar Jan 07 '16 23:01 alkhe

Sorry, I've been enjoying a long vacation away from my computer... so I only had little time to look into this.

The main problem I'm facing is that the two bundles (server- and client-side) must be generated from scratch at each modification, even though they are almost identical. The client-side includes index.js and mvi.js, and it targets browsers, while the server-side bundle only includes mvi.js and it targets node. I'm no webpack expert, but it seems to me that those small differences dictate two indipendent bundling processes, thus making hot reloading twice as slow.

Seeing the progress on hot reloading in cycle-core (cyclejs/cycle-core#46) I'm now thinking it might make more sense to work on a static (non isomorphic) app during development, and produce an isomorphic app only for production. If the state is preserved and you can even fix bugs that happened in the past, then the isomorphic side is not useful during development, and should be skipped if it slows down things (which is the case if we want to pass mvi.js through webpack).

abaco avatar Jan 08 '16 20:01 abaco

related: #15

Any news?

alkhe avatar Mar 14 '16 09:03 alkhe