The Next js framework uses the SWC compiler instead of Babel.
I need to write a plugin for SWC. Everything was working fine, but something happened. Now any plugin that I compile on my computer doesn't work in Next js.
I wrote about this many times in the SWC github. The SWC developers say something incomprehensible, but it seems that everything works for everyone except me.
I will leave links to all github discussions about this. There both the text of an error, and all data.
I don't write code. I'm installing the starter example from SWC
Separately, I note that I have tried a lot of versions of Rust, swc_core, swc_cli. Every time Next js breaks. I also tried doing this on a windows virtual machine and ubuntu. I really need help, help me understand why this is not working, even if I downgrade the swc version
https://github.com/swc-project/swc/issues/7381
https://github.com/swc-project/swc/issues/7386
https://github.com/swc-project/swc/discussions/7361
To reproduce a minimal example with an error you need to follow these steps
Install next js, put the plugin in the root folder, and include it in the config(next.config.js):
const nextConfig = {
experimental: {
swcPlugins: [
[require.resolve("./my_first_plugin.wasm"),{}]
],
},
}
module.exports = nextConfig
Auxiliary links:
https://swc.rs/docs/plugin/ecmascript/getting-started
The problem was solved with the update of SWC and Next js.
swc_cli - v0.91.42 next js - 13.4.3-canary.2