Registry / web-framework / esbuild-plugin-glslx

esbuild-plugin-glslx

JSON →
library0.1.1jsnpmunverified

A plugin for esbuild that enables importing *.glslx files, a GLSL extension for writing multiple WebGL 1.0 shaders in a single file using the export keyword. Current stable version is 0.1.1, with low release cadence. Key differentiators: provides build-time shader type checking via GLSLX compiler, optionally generates TypeScript type declarations for exported shaders, and integrates with esbuild's plugin system. Alternative solutions like webpack-glsl-loader lack built-in type checking. Requires esbuild and glslx as peer dependencies.

npm install esbuild-plugin-glslx
INSTALL
IMPORT
SIG · ESBUILD-PLUGIN-GLS
E
esbuild-plugin-glslx
web-frameworkjavascriptv0.1.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

default export
const glslxPlugin = require('esbuild-plugin-glslx')
import glslxPlugin from 'esbuild-plugin-glslx'
CommonJS require is correct; the package does not have a default ESM export.
named export (not available)
const glslx = require('esbuild-plugin-glslx').default
import { glslxPlugin } from 'esbuild-plugin-glslx'
The plugin is exported as a single default function, not as named exports.
type declaration (TypeScript)
declare module "*.glslx" { var values: Record<string, string>; export = values; }
declare module "*.glslx" { const shaders: any; export default shaders; }
Use export = values for CommonJS-style module; export default does not match the runtime shape.

Shows basic setup: require the plugin and add it to esbuild's plugins array.

const glslxPlugin = require('esbuild-plugin-glslx') require('esbuild').build({ entryPoints: ['app.js'], bundle: true, outfile: 'out.js', plugins: [glslxPlugin()], }).catch(() => process.exit(1))
Debug
Known issues
deprecatedThe glslx compiler itself is in maintenance mode and may not receive updates.
fix
Consider using glslify or other alternatives for active development.
affects: all
gotchaThe plugin does not support esbuild versions >=0.9.0 due to breaking changes in the plugin API.
fix
Use esbuild <0.9.0 or fork the plugin to adapt to newer API.
affects: >=0.9.0 (esbuild)
gotchaTypeScript declarations generated with writeTypeDeclarations: true may be incomplete for complex shader exports.
fix
Manually verify generated .d.ts files or use the blanket module declaration.
affects: all
breakingRequires Node.js >=10.x due to glslx dependency requirements.
fix
Upgrade Node.js to version 10 or later.
affects: all
Errors
Common errors & fixes
Error: Cannot find module 'glslx'
glslx is not installed as a dependency.
fix
Run npm install --save-dev glslx
TypeError: glslxPlugin is not a function
Using ES import (import glslxPlugin from ...) instead of require().
fix
Use const glslxPlugin = require('esbuild-plugin-glslx')
error: No loader is configured for ".glslx" files
The plugin is not applied to esbuild's build.
fix
Add glslxPlugin() to the plugins array in esbuild's build options.
Upgrade
Version history
0.1.1latest on npm
Audit
Dependencies
esbuildrequiredpeer dependency: this plugin hooks into the esbuild bundler
glslxrequiredpeer dependency: used for parsing and type-checking GLSLX files
Agent activity
2 hits · last 30 days
node
2
Resources
esbuild-plugin-glslx — npm install esbuild-plugin-glslx · libregistry