A ESBuild plugin for shaderity, which is a web-oriented shader utility.
Write a node program file as following:
// build.js
const esbuild = require('esbuild');
const shaderity = require('esbuild-plugin-shaderity');
esbuild.build({
entryPoints: ['./src/index.js'],
bundle: true,
outdir: 'dist',
plugins: [
shaderity(),
]
});
// simple.frag
precision mediump float;
in vec4 vColor;
void main() {
gl_FlagColor = vColor;
}
// ./src/index.js
import simpleFragmentShader from './simple.frag';
console.log(simpleFragmentShader);
Run the written build.js with node.
$ node build.js
The built file must be output to the ./dist directory.