Skip to content

fix: make aztec.js bundleable by vite#10744

Closed
olehmisar wants to merge 2 commits intoAztecProtocol:masterfrom
olehmisar:om/fix-vite-bundling
Closed

fix: make aztec.js bundleable by vite#10744
olehmisar wants to merge 2 commits intoAztecProtocol:masterfrom
olehmisar:om/fix-vite-bundling

Conversation

@olehmisar
Copy link
Contributor

Fixes #6073

@Thunkar
Copy link
Contributor

Thunkar commented Dec 16, 2024

Hi!

This is going to be addressed by #10704, which also starts a bigger refactor and code split that will make our libraries way more browser friendly.

Hopefully I can get that one in today to unblock you!

@olehmisar
Copy link
Contributor Author

@Thunkar please close this PR, if it was addressed in yours

@olehmisar
Copy link
Contributor Author

I merged master and see that import { sep } from "path" is still present. This will crash vite build.

@Thunkar
Copy link
Contributor

Thunkar commented Dec 18, 2024

I merged master and see that import { sep } from "path" is still present. This will crash vite build.

@olehmisar path still has to be polyfilled, how is vite build crashing?

@olehmisar
Copy link
Contributor Author

IDK. Vite just fails because it can’t destructure sep from path. Not destructuring fixes the issue for some reason. Idk why but it worked for me

@Thunkar
Copy link
Contributor

Thunkar commented Dec 18, 2024

@olehmisar have you tried the polyfills package I used here?

@olehmisar
Copy link
Contributor Author

@Thunkar
Copy link
Contributor

Thunkar commented Dec 18, 2024

I'll try your plugin with our vite box tomorrow and try to debug. The polyfill should support destructuring.

@olehmisar
Copy link
Contributor Author

I feel like too much of your time is being wasted on such a simple fix?

@Thunkar
Copy link
Contributor

Thunkar commented Dec 20, 2024

Hi @olehmisar, I've finally had time to test. It's not just the simple fix, but understanding why it happens (the codebase is going to keep evolving and there's many destructured imports all over, and some other that might come and break your flow in the future, even if we try our hardest to avoid browser-incompatible or polyfilled imports).

I am not able to reproduce this after the recent changes, and #10877 should further improve things. I'm not gonna close this until you get a chance to test it in the upcoming 0.68.0 release (hopefully today, early next week at worst)

@olehmisar
Copy link
Contributor Author

it was fixed

@olehmisar olehmisar closed this Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

building SSR with vite fails due to fs/promises

2 participants