slang-loader weekly downloads statistics
By AbdBarho (2 listings) · npm · Webpack plugins
Compile Slang shaders to WGSL at build time, for Vite, webpack, Rollup, esbuild and more.
slang-loader has 32 recorded weekly downloads on npm, a decrease of 60.5% over the past 30 days, ranking #2884 of 3,247 tracked listings.
About slang-loader
slang-loader
Compile Slang shaders to WGSL at build time. Supports Vite, Rollup, Rolldown, webpack, Rspack, Rsbuild, esbuild, Farm, Bun and unloader.
Uses Slang 2026.19.
Install
npm install -D slang-loader
Setup
Import the entry point for your bundler:
// vite.config.js
import slang from 'slang-loader/vite';
export default { plugins: [slang()] };
The same plugin is available from slang-loader/rollup, slang-loader/rolldown,
slang-loader/webpack, slang-loader/rspack, slang-loader/rsbuild, slang-loader/esbuild,
slang-loader/farm, slang-loader/bun and slang-loader/unloader.
slang-loader/unplugin exports the raw unplugin instance.
Usage
import wgsl, { entryPoints, reflection } from './scene.slang';
device.createShaderModule({ code: wgsl });
Each shader module exports:
- Default: generated WGSL code.
entryPoints: names, stages and compute workgroup sizes.reflection: Slang's full reflection object.
See example/ for a runnable WebGPU example.
Options
The slang() setup above works without configuration. All options are optional:
include: unplugin filter pattern; defaults to.slangfiles.exclude: unplugin filter pattern added to the built-in passthrough exclusions.types: generate TypeScript sidecars for.slangfiles; defaults totrue.
Custom include extensions are compiled but do not generate sidecars. The plugin leaves ?raw,
?url and ?inline imports to the bundler.
TypeScript
Successful builds generate *.slang.d.ts sidecars with literal entry point names, workgroup sizes
and the full reflection type:
import { entryPoints } from './scene.slang';
entryPoints[0].name; // "computeMain"
entryPoints[0].workgroupSize; // [16, 16, 1]
Ignore generated sidecars when formatting:
.prettierignore:*.slang.d.tsto skip formatting
Then choose one:
.gitignore:*.slang.d.tsif sidecars are not committed.gitattributes:*.slang.d.ts linguist-generatedif sidecars are committed
For files that have not been compiled yet, or when using moduleResolution: nodenext, add a fallback
to an environment declaration file such as vite-env.d.ts:
declare module '*.slang' {
export { default } from 'slang-loader/module';
export * from 'slang-loader/module';
}
The extension pattern is consumer-owned. Set types: false to disable sidecar generation.
Multi-file Shaders
Slang import, __include and #include references resolve relative to the importing file.
Dependencies are watched by supported bundlers, so editing one rebuilds its importing shaders.
// scene.slang
import scene.march; // scene/march.slang
// scene/march.slang
module march;
__include shapes; // scene/shapes.slang
// scene/shapes.slang
implementing march;
public float smoothMin(float a, float b, float k) { /* ... */ }
Imported symbols should be public. Search paths such as -I are not supported by the wasm API, so
references must resolve relative to their importer.
Programmatic API
import { loadSlang } from 'slang-loader';
const slang = await loadSlang();
const result = slang.compile(source, { path: '/blur.slang' });
result contains code, entryPoints, reflection, diagnostics and dependencies. The path
option controls relative dependency resolution; readFile can provide dependencies from another
source.
Licence
The package source is MIT. The distributed Slang compiler is Apache-2.0 WITH LLVM-exception and
ships with its required licence notices. See LICENSE.
Description from the npm listing.
- slang
- wgsl
- webgpu
- shader
- unplugin
- vite-plugin
- webpack-plugin
- rollup-plugin
- esbuild-plugin
- rspack-plugin
README badge
Show your rank in a README or on your website. The badge updates automatically.
Charts
Images: 30d · 1y · all time · 1600×900 dark
Adoption over time
7/30/90-day growth
Ranking history
Listing placement
Listing placement
Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.
Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.
Recent observations
Full history (170)Similar npm Webpack plugins plugins
All 20 slang-loader alternativesData source
Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.
Listing: https://www.npmjs.com/package/slang-loader. First seen Oct 16, 2026; last successful collection Dec 6, 2026. See the methodology.