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

building for different swc versions #1

Open
souporserious opened this issue May 4, 2023 · 2 comments
Open

building for different swc versions #1

souporserious opened this issue May 4, 2023 · 2 comments
Assignees

Comments

@souporserious
Copy link

Hello, I'm having trouble using this in Next.js and assuming it is version-related like mentioned in the readme. I pulled down the library and built the wasm file, but it did not work. I also tried rolling back to a previous Next.js canary like the SWC docs mentioned, which loaded instead of crashing, but does not seem to work still. Please see the reproduction here.

I'm happy to help try out a PR to get newer versions to work, just not sure how best to contribute since I'm new to Rust still 😇

@jcoon97 jcoon97 self-assigned this May 4, 2023
@jcoon97
Copy link
Owner

jcoon97 commented May 4, 2023

👋 The current version that's released is built against swc_core v0.74.*, which only works with @swc/core v1.3.44 ~ v1.3.47. Looking at the compatibility page, it looks like that @swc/core range would fall under Next v13.2.4 ~ v13.3.1, which unfortunately had an issue with loading Wasm plugins.

As far as I'm aware, Next v13.3.2+ should now be able to load SWC plugins; however, building the plugin against swc_core v0.75.* causes the plugin to panic when calling get_context.

I plan on filling out a bug report on the SWC repository for them to investigate, and will build/publish an update to the plugin once that's been resolved!

For an example of using the plugin with @swc/core v1.3.44 ~ v1.3.47, I've created this environment over on CodeSandbox. Though it doesn't make use of Next's integration with SWC (it uses @swc/core instead), hopefully the plugin will integrate with Next once we're able to build against swc_core v0.75.* in the near future.

@souporserious
Copy link
Author

Ah, good to know, I appreciate the insight and the example! I was getting the panic as well and didn't realize it was a bug causing it.

Thank you for this plugin btw! I started building my own pipeline through esbuild for docs when I realized I just needed to be able to glob MDX files and came across your package.

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

No branches or pull requests

2 participants