Registry / web-framework / esbuild-plugin-glsl

esbuild-plugin-glsl

JSON →
library1.4.1jsnpmunverified

An esbuild plugin for importing GLSL, WGSL, frag, and vert shader files as strings with optional minification. Current stable version is 1.4.1, released with regular updates. It integrates tightly with esbuild's build process, supporting minify, resolveIncludes, and preserveLegalComments options. Unlike generic text loaders, it provides shader-aware features like include resolution and comment preservation. Requires Node >= 18 and esbuild 0.x.x, ships TypeScript type definitions, making it ideal for WebGL/WebGPU projects using esbuild.

npm install esbuild-plugin-glsl
INSTALL
IMPORT
SIG · ESBUILD-PLUGIN-GLS
E
esbuild-plugin-glsl
web-frameworkjavascriptv1.4.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

glsl
import { glsl } from 'esbuild-plugin-glsl'
const glsl = require('esbuild-plugin-glsl')
Named export; ESM-only since v1. Requires esbuild plugin system.

Shows basic esbuild build with the glsl plugin, enabling minification and include resolution for shader files.

import { build } from 'esbuild'; import { glsl } from 'esbuild-plugin-glsl'; await build({ entryPoints: ['app.js'], outfile: 'dist/bundle.js', bundle: true, plugins: [glsl({ minify: true, resolveIncludes: true })] });
Debug
Known issues
breakingPlugin is ESM-only since v1.0.0; CommonJS require() will fail.
fix
Use import statement and set module to ESM or use dynamic import.
affects: >=1.0.0
breakingRequires esbuild 0.x.x as peer dependency; incompatible with esbuild 1.x.x.
fix
Pin esbuild to 0.x.x in package.json.
affects: >=1.0.0
gotchaShader files are imported as default exports (string), but TypeScript may complain without type declarations.
fix
Add a shaders.d.ts file with module declarations as shown in README.
affects: >=1.0.0
gotchaThe minify option follows esbuild's minify setting by default, which may be false even if you set it true in the plugin.
fix
Explicitly set minify: true in plugin options.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'esbuild-plugin-glsl'
Package not installed or not included in dependencies.
fix
Run 'npm install esbuild-plugin-glsl' and ensure it's in package.json.
Error: The esbuild plugin 'esbuild-plugin-glsl' must be an object with a 'name' and 'setup' function.
Incorrect import; importing default instead of named export.
fix
Use import { glsl } from 'esbuild-plugin-glsl'.
Upgrade
Version history
1.4.1latest on npm
Audit
Dependencies
esbuildrequiredPeer dependency; must be installed separately as the plugin hooks into esbuild's plugin system.
Agent activity
2 hits · last 30 days
node
2
Resources
esbuild-plugin-glsl — npm install esbuild-plugin-glsl · libregistry