A webpack loader for GLSL shader files, supporting nested imports for code reuse. Version 1.0.1 is the latest stable release; the project appears low-activity with no recent updates. It integrates GLSL shaders into webpack bundles by returning the shader as a string, with a SASS-like @import syntax for modular shader development. Differentiators include simple inline import resolution and no additional runtime dependencies, though it lacks deduplication and error checking for imports. Suitable for webpack 1–4 projects requiring WebGL shader inclusion.
npm install webpack-glsl-loaderVerified import paths — ran on the pinned version, not inferred.
Configures webpack with glsl-loader, imports a shader, and uses @import for nested includes.
Manually deduplicate imports or avoid importing the same file in multiple places.
Test shaders as a single contiguous file before using imports.
Use module.rules in webpack config as shown in quickstart.
Ensure webpack version compatibility; consider using glslify-loader for webpack 5.
Use the imported value as a string: gl.shaderSource(shader, fragmentShader);
Add the loader rule to webpack.config.js: { test: /\.glsl$/, use: 'webpack-glsl' }Run: npm install --save-dev webpack-glsl-loader
Verify the import path relative to the shader file, and omit the .glsl extension in the @import statement.