esbuild plugin for glslify
โ ๏ธ At the moment, this only works withrequire('./shader.glsl)
calls. Esbuild doesn't shim the node environment, which makes it tricky to require glslify in the front-end to use template literals.
npm i ayamflow/esbuild-glslify -S
โน๏ธ Refer to the esbuild plugins docs
import esbuild from 'esbuild'
import glslify from 'esbuild-glslify'
esbuild.build({
plugins: [glslify()]
})
Or if you want to use specific extensions: (defaults to .glsl, .vert, .frag, .vs, .fs)
import esbuild from 'esbuild'
import glslify from 'esbuild-glslify'
const plugin = glslify({
extensions: ['.glsl', '.custom.shader']
})
esbuild.build({
plugins: [plugin]
})
It supports source transforms as well:
import esbuild from 'esbuild'
import glslify from 'esbuild-glslify'
esbuild.build({
plugins: [glslify({
transform: ['glslify-hex']
})]
})
MIT. See LICENSE for details.