GLSL
Parcel supports importing WebGL shaders using the @parcel/transformer-glsl
plugin. When a .glsl
, .vert
or .frag
file is detected, it will be installed into your project automatically.
Example usage
#GLSL files are imported into JavaScript as a string, which you can load into a WebGL context.
import frag from './shader.frag'
// ...
gl.shaderSource(..., frag);
// ...
Dependencies
#Parcel also supports dependencies within GLSL files using a pragma, including from libraries in node_modules. These are bundled together into a single shader that you can load into a WebGL context.