You know what sucks? The way phaser loads GLSL files. In that, it doesnt by itself. What also sucks is including code for a totally differnt language as a list of strings in your codebase. Whenever you come across this sort of thing, its usually best to try and store the “nonindigenous code” somewhere sles, like a seperate file. This is especially true if you find it can be templated.
THis is exactly the problem I encountered in Phaser.js, so I made a quick solution.
Phaser GLSL Loader
This is a simple GLSL loader that is meant to work with Phaser and Webpack.
Lets say you’re working in phaser, and you see a really cool looking fragment shader you want to use.
So you go to the phaser examples, and they show you to integrate your code just like this: