A webpack loader that enables seamless integration of Lygia shaders by resolving #include directives at build time. This eliminates runtime network requests for shader dependencies and improves performance. The loader handles both local file includes and remote Lygia library imports with automatic caching.
npm install webpack-lygia-loaderAdd to your webpack configuration:
module.exports = {
module: {
rules: [
{
test: /\.(glsl|vs|fs|vert|frag)$/,
exclude: /node_modules/,
use: [
'raw-loader',
'webpack-lygia-loader'
]
}
]
}
}Then in your shaders you can include Lygia modules:
#include "lygia/math/const.glsl"
#include "lygia/space/ratio.glsl"- Resolves Lygia includes at build time
- Caches downloaded files
- Supports local file includes
- Works with Next.js and other webpack-based bundlers
MIT