A WGSL minifier for WebGPU shaders, distributed as a WebAssembly build for browsers and Node.js (v0.3.x, monthly releases). Unlike general JS minifiers, it specializes in WGSL: it understands shader syntax, can tree-shake unused declarations, rename identifiers, optimize syntax, and optionally mangle external bindings. Ships TypeScript definitions and supports source maps via source-map crate. Relies on an async WASM initialization step that is a common footgun.
npm install minirayNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates async initialization, then minifies a WGSL shader with whitespace, identifier, syntax, and tree-shaking enabled.
Always await initialize() before using the library.
For browser usage, either copy miniray.wasm to a public folder or use a CDN. Then pass the URL to initialize({ wasmURL: ... }).Always check result.errors after minification.
Use import { initialize, minify } from 'miniray' instead of relying on the global.If your project uses ES modules, use ESM imports: import { initialize, minify } from 'miniray'.Ensure initialize() is called and awaited before using other API functions.
Check that the wasmURL is correct and that the binary is accessible. Also ensure initialize() was awaited.
Run npm install miniray (version >=0.3.0) and use proper import syntax.
Ensure the URL points to the actual miniray.wasm binary file.
No dependency data recorded yet.