Skip to content

Latest commit

 

History

History
50 lines (36 loc) · 1.2 KB

CONTRIBUTING.md

File metadata and controls

50 lines (36 loc) · 1.2 KB

Install rust

You can follow instructions at 'Install Rust' page from the official rust website

Add wasm target to rust

rustup target add wasm32-wasi

Running tests

# run all test suite
cargo test

# run individual test
cargo test js_choices_may_contain_expressions

# you may specify only prefix of test name to target more cases
cargo test jsx_

Building for production

# (alias for `cargo build --target wasm32-wasi`)
cargo build-wasi --release

Then wasm binary would be on the path: ./target/wasm32-wasi/release/lingui_macro_plugin.wasm

You can check it in your own project or in the examples/nextjs-13 example in this repo by specifying full path to the WASM binary:

/** @type {import('next').NextConfig} */
const nextConfig = {
  experimental: {
    swcPlugins: [
      ['/Users/tim/projects/lingui-macro-plugin/target/wasm32-wasi/release/lingui_macro_plugin.wasm', {}],
    ],
  },
};

module.exports = nextConfig;

Rust Version

It's important to build a plugin with the same Rust version used to build SWC itself.

This project uses rust-toolchain file in the root of project to define rust version.