Publishing plugins
If you prefer reading codes, you can refer to the repository for official plugins.
Register on plugins.swc.rs
After publishing your plugin package, add it to the plugin crawler index so it appears on plugins.swc.rs.
See Registering plugins for the step-by-step guide.
Creating a npm package
Building a plugin as a wasm
You can run your plugin as a wasm file by running
It will create target/wasm32-wasi/release/your_plugin_name.wasm or target/wasm32-unknown-unknown/release/your_plugin_name.wasm, depending on your config.
Creating a npm package for plugin
Add the following to your package.json:
Advanced: Improving your plugin
Adjusting configuration for smaller binary
You can reduce the size of the plugin by configuring cargo.
In your Cargo.toml file, you can add the following lines.
Removing log for release mode
If logging of your crate is too much, you can remove it by enabling release_max_level_* of tracing, like
