Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to Vite? #253

Open
zardoy opened this issue Nov 28, 2021 · 11 comments
Open

Migrate to Vite? #253

zardoy opened this issue Nov 28, 2021 · 11 comments
Labels

Comments

@zardoy
Copy link
Contributor

zardoy commented Nov 28, 2021

It Might resolve #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.

@rom1504
Copy link
Member

rom1504 commented Nov 28, 2021

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

@zardoy
Copy link
Contributor Author

zardoy commented Nov 29, 2021

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 :

@rom1504
Copy link
Member

rom1504 commented Dec 24, 2021

What would be a more clean solution?

@rom1504
Copy link
Member

rom1504 commented Dec 26, 2021

re-open if you feel like investigating this more deeply

@rom1504 rom1504 closed this as completed Dec 26, 2021
@zardoy
Copy link
Contributor Author

zardoy commented Dec 26, 2021

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.

@rom1504
Copy link
Member

rom1504 commented Dec 26, 2021

ok let's re-open to discuss

@rom1504 rom1504 reopened this Dec 26, 2021
@rom1504
Copy link
Member

rom1504 commented Dec 26, 2021

Get rid of polyfylling node modules.

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

@rom1504
Copy link
Member

rom1504 commented Dec 26, 2021

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
Copy link
Member

rom1504 commented Dec 26, 2021

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

@AwesomestCode
Copy link
Member

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

@zardoy
Copy link
Contributor Author

zardoy commented Aug 9, 2023

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 zardoy mentioned this issue Sep 19, 2023
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants