prismarine-web-client icon indicating copy to clipboard operation
prismarine-web-client copied to clipboard

Migrate to Vite?

Open zardoy opened this issue 3 years ago • 11 comments

It Might resolve https://github.com/PrismarineJS/prismarine-web-client/issues/210 in a better way.

Its kinda popular alternative, have you ever tried it? For me in projects at any scale it always served an extreme performance. For now I’m just asking here, will try it here in a few days.

zardoy avatar Nov 28 '21 15:11 zardoy

try it, if it works faster without breaking things then let's do it yet

rom1504 avatar Nov 28 '21 21:11 rom1504

I tried it in https://github.com/PrismarineJS/prismarine-viewer/tree/master/examples/standalone. Kinda fast, but doesn't work at all. Polyfilling node with it is much harder than I expected (they're doing it on purpose as its not recommended).

And also about this repo, Vite would punish you for 500kb bundle size, but here, index.js have ~35mb. Have you thought about getting rid of polyfilling node in favor of more clean solution?

Anyway, I'll keep exploring ways to make it work :

zardoy avatar Nov 29 '21 03:11 zardoy

What would be a more clean solution?

rom1504 avatar Dec 24 '21 21:12 rom1504

re-open if you feel like investigating this more deeply

rom1504 avatar Dec 26 '21 15:12 rom1504

I really wanted to see it here, but unfortunately didn't have much time recently :( I'll try to take a fresh look into it in next year.

What would be a more clean solution?

Get rid of polyfylling node modules. As I mentioned above, Vite is a modern alternative to webpack with builtin dev server and blazing performance, however it has some drawbacks. For example, it's hard (or I just didn't find an easy way) to polyfil node. However they support Rollup plugins, so, again, there should be a way...

Btw, with Snowpack it was extremely easy. It supported --polyfil-node flag so you could just run snowpack --polyfil-node and I would do all the magic for you (even without creating a config file), however it's not maintained anymore.

Hope I made it clear, feel free correct me.

zardoy avatar Dec 26 '21 16:12 zardoy

ok let's re-open to discuss

rom1504 avatar Dec 26 '21 16:12 rom1504

Get rid of polyfylling node modules.

yes I'm asking about your solution to do that and that would be cleaner than polyfilling

rom1504 avatar Dec 26 '21 16:12 rom1504

For example, it's hard (or I just didn't find an easy way) to polyfil node

supporting node modules is the main reason why we use webpack to begin with, so that doesn't seem to work here

rom1504 avatar Dec 26 '21 16:12 rom1504

something interesting is that webpack is going straight in the wrong direction by removing all the polyfilling by default it seems that browserify is still the best bundler, maybe we should go back to it

rom1504 avatar Dec 26 '21 16:12 rom1504

I will note that dev build performance has magically increased a lot recently for me though

raymondjxu avatar Dec 30 '21 22:12 raymondjxu

Hi all! How's it going? I've finally managed to put my focus on this fantastic project (I've promised sandboxed mc to a lot of folks). I've already included a few cool changes in my fork and have even more ideas to implement soon!

Btw what about Vite, it turns out it wasn't that hard to polyfill node modules (though it still doesn't support false aliases). eg prismarine-viewer works fine with Vite setup, however, the performance is still far from ideal... I will continue investigating it.

What I really miss from the current setup is the hot reload. eg if I make any changes I need to fully reload the page, reconnect, and so on...

Are there other changes you might be interested in? i see some code parts are hid/in corect

zardoy avatar Aug 09 '23 19:08 zardoy