You may want to buildDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Pratyay360/upiqrcode/llms.txt
Use this file to discover all available pages before exploring further.
upiqrcode from source if you need to customize the library, contribute a fix or feature, or test changes before they are published to npm. The build toolchain is straightforward: Rust handles the library code, and wasm-pack compiles it to WebAssembly and generates the JavaScript bindings and TypeScript types automatically.
Prerequisites
Install Rust
Install the Rust toolchain via After installation, restart your terminal or run
rustup. This also installs cargo, the Rust package manager:source "$HOME/.cargo/env" to make the cargo and rustc commands available.Install wasm-pack
Install Verify the installation:
wasm-pack, the tool that compiles Rust to WebAssembly and generates the npm-compatible output:Build commands
Runwasm-pack build with the --target flag that matches your intended environment. The build compiles the Rust library and writes the output to a pkg/ directory.
| Target | Use case |
|---|---|
bundler | Use with Vite, webpack 5, or Rollup. The generated module uses import statements and relies on your bundler to load the .wasm file. |
web | Direct browser usage via <script type="module">. No bundler required; the .wasm file is fetched at runtime. |
nodejs | CommonJS output for use in Node.js scripts and servers. |
Output: the pkg/ directory
After a successful build,wasm-pack creates a pkg/ directory with everything needed to publish or consume the package locally:
pkg
upiqrcode.js
upiqrcode_bg.wasm
upiqrcode.d.ts
upiqrcode_bg.wasm.d.ts
package.json
upiqrcode.js— JavaScript bindings that wrap the WASM exports, including theinitdefault export and the namedupiqrcodeandsvg_qr_codefunctions.upiqrcode_bg.wasm— The compiled WebAssembly binary.upiqrcode.d.ts— TypeScript type declarations, including theUpiqrcodeParamsandUpiqrcodeResultinterfaces.package.json— Generated package metadata, ready to publish to npm or link locally.
Using your local build
You have two options for consuming the local build in another project. Option 1 —npm link: Register the local build as a globally linked package and then link it into your consuming project:
package.json: Reference the pkg/ directory directly using a file: path:
package.json
npm install to symlink the dependency.
Running tests
The test suite useswasm-bindgen-test, which runs in a headless browser. Make sure you have Firefox or Chrome installed:
Release optimization
Contributing
If you have fixed a bug or added a feature, open a pull request on GitHub:upiqrcode on GitHub
Browse the source, open issues, and submit pull requests.
Next steps
API reference: upiqrcode()
See the full parameter reference, return type, and validation rules for the
upiqrcode function.