0

I create the first plugin exactly like in the documentation - https://swc.rs/docs/plugin/ecmascript/getting-started

I didn't change anything after: swc plugin new --target-type wasm32-wasi my-first-plugin.

Plugin does nothing.

add to Next js:

const nextConfig = {
  experimental: {
    appDir: true,
    swcPlugins: [
        [require.resolve("./my_first_plugin.wasm"),{}]
    ],
  },
}

Start the server - npm run dev

I see in the console:

ready - started server on 0.0.0.0:3000, url: http://localhost:3000
warn  - You have enabled experimental features (appDir, swcPlugins) in next.config.js.
info  - Thank you for testing `appDir` please leave your feedback at https://nextjs.link/app-feedback
warn  - Experimental features are not covered by semver, and may cause unexpected or broken application behavior. Use at your own risk.

And the server immediately stops. No errors

The plugin builds without errors.

Tried two builds:

  1. wasm32-wasi
  2. wasm32-unknown-unknown

I am using the latest versions of rust, cargo, next js

Jmb
  • 18,893
  • 2
  • 28
  • 55
Roman
  • 175
  • 2
  • 3
  • 15

0 Answers0