{"library":"parcel-plugin-wasm.rs","title":"Parcel 1.x wasm-bindgen plugin for Rust","description":"parcel-plugin-wasm.rs is a Parcel 1.x bundler plugin designed to integrate Rust projects compiled to WebAssembly (Wasm) using `wasm-bindgen`. It streamlines the development workflow by automatically compiling Rust code with `wasm-pack` when Parcel 1.x builds the project. The latest stable version available is 1.3.0. A key differentiator was its ability to provide zero-configuration Rust/Wasm compilation for Parcel projects at a time when such integration was less mature. However, it is explicitly designed for `parcel-bundler` (Parcel 1.x), which has been officially deprecated and is no longer maintained. Parcel 2.x includes its own `@parcel/transformer-rust` for native Rust/Wasm support, rendering this plugin obsolete for modern Parcel environments.","language":"javascript","status":"abandoned","last_verified":"Wed Apr 22","install":{"commands":["npm install parcel-plugin-wasm.rs"],"cli":null},"imports":["import { foo } from 'path/to/Cargo.toml'","import lib from 'path/to/Cargo.toml'","import type { WasmModule } from 'path/to/Cargo.toml'"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"/* file: my-crate/src/lib.rs */\nextern crate wasm_bindgen;\nuse wasm_bindgen::prelude::*;\n\n#[wasm_bindgen]\npub fn greet(name: &str) -> String {\n  format!(\"Hello, {}!\", name)\n}\n\n/* file: src/index.js */\nimport { greet } from '../my-crate/Cargo.toml';\n\ndocument.getElementById('app').innerHTML = `\n  <h1>Rust + WebAssembly in Parcel 1.x</h1>\n  <p>${greet('Parcel user')}</p>\n`;\n\nconsole.log('Greeting from Rust:', greet('world'));\n\n/* file: package.json (relevant part) */\n{\n  \"name\": \"my-parcel-wasm-app\",\n  \"version\": \"1.0.0\",\n  \"devDependencies\": {\n    \"parcel-bundler\": \"^1.12.5\",\n    \"parcel-plugin-wasm.rs\": \"^1.3.0\"\n  },\n  \"scripts\": {\n    \"start\": \"parcel src/index.html\",\n    \"build\": \"parcel build src/index.html\"\n  }\n}\n\n/* file: src/index.html */\n<!DOCTYPE html>\n<html>\n<head>\n  <title>Parcel WASM Example</title>\n</head>\n<body>\n  <div id=\"app\"></div>\n  <script src=\"index.js\"></script>\n</body>\n</html>","lang":"javascript","description":"Demonstrates a basic setup for integrating a Rust project compiled to WebAssembly with Parcel 1.x using `parcel-plugin-wasm.rs`. It includes the necessary Rust, JavaScript, and `package.json` configurations to greet a user from WebAssembly.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}