glsl loader for webpack working with chunks writed by @makio64 & inspired by ShaderLoader from @cabbibo
install:
npm install shader-loader
config webpack:
module: {
loaders: [
{ test: /\.glsl$/, loader: 'shader' },
],
},
shader: {
// chunks folder, chunkpath by default is ""
chunkPath: "chunks"
}
use it:
var myShader-vx = require("./myShader-vx.glsl");
// => returns myShader-vx.glsl as string and with the chunks replaced
if you use the synthax $name in your shader it will be replaced by the content of name.glsl ( example with $fog above ) :
void main(void) {
gl_FragColor = vec4(1.0);
$fog //replace by the content of chunks/fog.glsl
}