{"library":"shader-loader","title":"shader-loader","description":"A Webpack loader for GLSL shader files (.glsl, .vs, .fs) that supports shader chunk/inclusion syntax ($xxx). Current version 1.3.1, last updated 2017, no active development. Works with Webpack 2 and 3 (not Webpack 4+). Differentiates from raw-loader or glslify by allowing inclusion of GLSL chunks via $include syntax directly in shader source, inspired by cabbibo's ShaderLoader. Suitable for legacy projects using Three.js or similar with Webpack 2/3.","language":"javascript","status":"maintenance","last_verified":"Sat Apr 25","install":{"commands":["npm install shader-loader"],"cli":null},"imports":["import vertexShader from 'shader.vs';","module.exports = { module: { rules: [ { test: /\\.(glsl|vs|fs)$/, loader: 'shader-loader', options: { glsl: { chunkPath: 'path/to/chunks' } } } ] } };","void main() { $noise }"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"// webpack.config.js\nconst path = require('path');\nmodule.exports = {\n  entry: './src/index.js',\n  output: { path: path.resolve(__dirname, 'dist'), filename: 'bundle.js' },\n  module: {\n    rules: [\n      {\n        test: /\\.(glsl|vs|fs)$/,\n        loader: 'shader-loader',\n        options: {\n          glsl: {\n            chunkPath: path.resolve(__dirname, 'glsl/chunks')\n          }\n        }\n      }\n    ]\n  }\n};\n\n// src/vertex.vs\nvoid main() { gl_Position = vec4(position, 1.0); }\n\n// src/index.js\nimport vertexShader from './vertex.vs';\nconsole.log(vertexShader);","lang":"javascript","description":"Sets up Webpack config to load .glsl/.vs/.fs files with shader-loader, including chunk path. Then imports a vertex shader in JavaScript.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}