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

Fix vite build #11

Merged
merged 7 commits into from
Mar 1, 2024
Merged

Fix vite build #11

merged 7 commits into from
Mar 1, 2024

Conversation

AlexErrant
Copy link
Member

@AlexErrant AlexErrant commented Feb 28, 2024

Closes #9

This PR updates wasm-bindgen-rayon to "1.2.1", which means we no longer need to put initThreadPool() and fsrs.computeWeights in a separate web worker. Indeed, in order to get vite build to work, this must be done. Vite users must also use @surma/rollup-plugin-off-main-thread when building, but must not use it in dev mode. The PR demos how to do this.

@ishiko732 please feel free to test this, submit feedback, or whatever. I know virtually nothing about bundlers, just giving you the chance to say something since we're in the same boat. I also plan on opening an issue/PR with wasm-bindgen-rayon once I catch my breath.

@ishiko732
Copy link
Member

LGTM. I can train successfully in pnpm run dev and pnpm run serve.

@ishiko732
Copy link
Member

I'm not sure if it's possible to directly use Rollup to solve compatibility issues after compiling fsrs-browser. ts-fsrs uses Rollup to generate ESM/CommonJS bundles.

@AlexErrant
Copy link
Member Author

I'm not very familiar with ESM vs CommonJS - I've little experience with Node. Since this package uses wasm-bindgen-rayon which probably doesn't work in Node (at least I don't see any evidence that it does), can we ignore the compatibility issues and just go with ESM?

@ishiko732
Copy link
Member

can we ignore the compatibility issues and just go with ESM?

I think at this stage, we can ignore the compatibility issues and proceed with using ESM only.

@AlexErrant AlexErrant merged commit 3910b7e into main Mar 1, 2024
1 check passed
@AlexErrant AlexErrant deleted the vite branch March 1, 2024 02:15
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.

[Bug] unable to train
2 participants