A GLSL-to-JavaScript module transpiler for the threeify ecosystem. Version 2.0.7 offers CLI and configuration-based compilation of raw GLSL files (.glsl, .frag, .vert) into ES modules, with support for #pragma once include guards, watch mode, minification, and optional JavaScript/TypeScript includes. It integrates seamlessly into build pipelines, preserving IDE syntax highlighting and linting for shader source files. Unlike runtime shader compilers, this transpiler generates static JS modules, enabling tree-shaking and optimized bundling. Released under MIT license with TypeScript type definitions included.
npm install threeify-glsl-transpilerNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates configuration via threeify.json, CLI usage, and programmatic transpilation of a GLSL file into an ES module.
Always import from the generated .glsl.js file, e.g., import code from './shader.glsl.js';
Update imports from 'require()' to 'import' statements. Ensure your project is ESM-compatible (use "type": "module" in package.json).
Avoid using this option in production. If needed, pin version to 1.x and monitor releases.
Use consistent folder structures and avoid identical shader content across multiple paths.
Run a separate GLSL linter (e.g., glslangValidator) on your source files before transpilation.
Change to dynamic import: const { transpileFile } = await import('threeify-glsl-transpiler');Change import to './shader.glsl.js' (the generated output).
Either create a threeify.json in the project root or pass all flags via command line: threeify-glsl-transpiler -p ./src -o ./dist
No dependency data recorded yet.