{"id":25628,"library":"gl-format-compiler-error","title":"gl-format-compiler-error","description":"Formats WebGL GLSL compiler errors with code snippets and shader type context. Current stable version 1.0.3, no active release cadence (last updated 2015). Key differentiator: produces both a long human-readable error with source lines and a short error string. Works with glsl-shader-name for shader naming. Lightweight and focused on WebGL 1.0 error formatting.","status":"active","version":"1.0.3","language":"javascript","source_language":"en","source_url":"https://github.com/wwwtyro/gl-format-compiler-error","tags":["javascript","stackgl","webgl","glsl"],"install":[{"cmd":"npm install gl-format-compiler-error","lang":"bash","label":"npm"},{"cmd":"yarn add gl-format-compiler-error","lang":"bash","label":"yarn"},{"cmd":"pnpm add gl-format-compiler-error","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Package is CJS only; ESM import may fail without bundler or esm shim.","wrong":"import formatCompilerError from 'gl-format-compiler-error'","symbol":"formatCompilerError","correct":"var formatCompilerError = require('gl-format-compiler-error')"}],"quickstart":{"code":"var formatCompilerError = require('gl-format-compiler-error');\nvar gl = document.createElement('canvas').getContext('webgl');\nvar shader = gl.createShader(gl.VERTEX_SHADER);\ngl.shaderSource(shader, 'void main() { gl_Position = vec4(1.0); }');\ngl.compileShader(shader);\nif (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {\n  var errLog = gl.getShaderInfoLog(shader);\n  var fmt = formatCompilerError(errLog, shaderSource, gl.VERTEX_SHADER);\n  console.warn(fmt.long);\n  throw new Error(fmt.short);\n}","lang":"javascript","description":"Shows basic usage: compile a shader, capture error, format using the library."},"warnings":[{"fix":"Pass the exact source string variable used in gl.shaderSource.","message":"The 'source' argument must be the exact shader source string passed to gl.shaderSource. Using a different string may produce incorrect line numbers.","severity":"gotcha","affected_versions":"*"},{"fix":"Use gl.VERTEX_SHADER or gl.FRAGMENT_SHADER.","message":"The 'type' argument expects gl.VERTEX_SHADER or gl.FRAGMENT_SHADER (numeric constants). Passing a different value may produce mislabeled error messages.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use require('gl-format-compiler-error') or configure bundler to handle CJS.","cause":"Using ES import syntax with a CJS-only package.","error":"TypeError: formatCompilerError is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}