UNPKG

@wasm-tool/rollup-plugin-rust

Version:

Rollup plugin for bundling and importing Rust crates.

30 lines (24 loc) 608 B
import rust from "@wasm-tool/rollup-plugin-rust"; import serve from "rollup-plugin-serve"; import livereload from "rollup-plugin-livereload"; import { terser } from "rollup-plugin-terser"; const is_watch = !!process.env.ROLLUP_WATCH; export default { input: { example: "Cargo.toml", }, output: { dir: "dist/js", format: "es", sourcemap: true, }, plugins: [ rust(), is_watch && serve({ contentBase: "dist", open: true, }), is_watch && livereload("dist"), !is_watch && terser(), ], };