Registry / http-networking / glslify-loader

glslify-loader

JSON →
library2.0.0jsnpmunverified

Webpack loader for glslify that inlines GLSL #include and source transforms. Current stable version 2.0.0, released 2018-05, no recent updates. Part of the stackgl ecosystem. Requires raw-loader to emit a string. Limited to webpack 4 and below; not compatible with webpack 5's asset modules. Alternatives: vite-plugin-glslify.

npm install glslify-loader
INSTALL
IMPORT
SIG · GLSLIFY-LOADER
G
glslify-loader
http-networkingjavascriptv2.0.0
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 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

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

glslify-loader
import source from 'raw-loader!glslify-loader!./shader.glsl'
const source = require('glslify-loader!./shader.glsl')
Must be used as a webpack loader, not a direct import. Use inline syntax or webpack config.
glslify-loader (config)
module.exports = { module: { rules: [ { test: /\.(glsl|vs|fs|vert|frag)$/, use: ['raw-loader', 'glslify-loader'] } ] } }
module.exports = { module: { rules: [ { test: /\.glsl$/, loader: 'glslify-loader' } ] } }
Always include raw-loader before glslify-loader, or chain them properly.
options
use: [ 'raw-loader', { loader: 'glslify-loader', options: { transform: [['glslify-hex', {}]] } } ]
use: [ 'raw-loader', { loader: 'glslify-loader', query: { transform: [...] } } ]
Use 'options' (webpack 4+); 'query' is deprecated.

Webpack configuration and example GLSL file using glslify-loader with a source transform, then importing the resolved shader string.

// webpack.config.js module.exports = { module: { rules: [ { test: /\.(glsl|vs|fs|vert|frag)$/, exclude: /node_modules/, use: [ 'raw-loader', 'glslify-loader' ] } ] } }; // my-shader.glsl #version 300 es precision highp float; #pragma glslify: noise = require('glsl-noise/simplex/3d') out vec4 outColor; uniform vec3 pos; void main() { float n = noise(pos); outColor = vec4(vec3(n), 1.0); } // app.js import source from './my-shader.glsl'; console.log(source); // string containing resolved GLSL
Debug
Known issues
breakingglslify-loader is not compatible with webpack 5. Use raw-loader with webpack 5 or migrate to a different loader.
fix
Downgrade to webpack 4 or use an alternative like vite-plugin-glslify.
affects: >=2.0.0
breakingraw-loader is required before glslify-loader; omitting it causes the loader to receive a JavaScript module object instead of raw GLSL text.
fix
Add 'raw-loader' before 'glslify-loader' in the loader chain.
affects: >=1.0.0
deprecatedThe 'query' option is deprecated in webpack 4; use 'options' instead.
fix
Replace 'query' property with 'options' in loader configurations.
affects: >=2.0.0
gotchaSource transforms (e.g., glslify-hex) must be installed separately; they are not bundled with glslify-loader.
fix
Install required transforms via npm and list them in the loader options.
affects: >=1.0.0
gotchaESM import syntax for glsl files requires webpack 2+ and proper module rules; simple require('file.glsl') works in Node but not webpack.
fix
Use webpack's import syntax within a webpack-bundled project; do not run the file directly with Node.
affects: >=1.0.0
Errors
Common errors & fixes
Module not found: Error: Can't resolve 'glslify-loader'
glslify-loader is not installed or not resolved in webpack's module paths.
fix
Run 'npm install glslify-loader' and ensure webpack configuration includes node_modules in resolve.modules.
Error: glslify-loader: 'raw-loader' must be placed before this loader in the chain.
The loader order is reversed; raw-loader should be first.
fix
Reorder loaders so 'raw-loader' comes before 'glslify-loader' in the use array.
TypeError: loader option 'query' is deprecated
Using 'query' property in webpack 4+ loader configuration.
fix
Replace 'query' with 'options' in the loader object.
Error: Could not locate a Glslify transform 'glslify-hex'
The specified transform package is not installed.
fix
Install the transform package: 'npm install glslify-hex'.
Upgrade
Version history
2.0.0latest on npm
Audit
Dependencies
raw-loaderoptionalMust be used before glslify-loader to output raw string; otherwise glslify-loader may receive a JS module.
webpackrequiredOnly tested with webpack 4; no webpack 5 compatibility.
Agent activity
12 hits · last 30 days
node
12
Resources
glslify-loader — npm install glslify-loader · libregistry