{"id":21251,"library":"esbuild-plugin-glsl","title":"esbuild-plugin-glsl","description":"An esbuild plugin for importing GLSL, WGSL, frag, and vert shader files as strings with optional minification. Current stable version is 1.4.1, released with regular updates. It integrates tightly with esbuild's build process, supporting minify, resolveIncludes, and preserveLegalComments options. Unlike generic text loaders, it provides shader-aware features like include resolution and comment preservation. Requires Node >= 18 and esbuild 0.x.x, ships TypeScript type definitions, making it ideal for WebGL/WebGPU projects using esbuild.","status":"active","version":"1.4.1","language":"javascript","source_language":"en","source_url":"https://github.com/vanruesc/esbuild-plugin-glsl","tags":["javascript","esbuild","plugin","glsl","frag","vert","wgsl","shader","import","typescript"],"install":[{"cmd":"npm install esbuild-plugin-glsl","lang":"bash","label":"npm"},{"cmd":"yarn add esbuild-plugin-glsl","lang":"bash","label":"yarn"},{"cmd":"pnpm add esbuild-plugin-glsl","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency; must be installed separately as the plugin hooks into esbuild's plugin system.","package":"esbuild","optional":false}],"imports":[{"note":"Named export; ESM-only since v1. Requires esbuild plugin system.","wrong":"const glsl = require('esbuild-plugin-glsl')","symbol":"glsl","correct":"import { glsl } from 'esbuild-plugin-glsl'"}],"quickstart":{"code":"import { build } from 'esbuild';\nimport { glsl } from 'esbuild-plugin-glsl';\n\nawait build({\n  entryPoints: ['app.js'],\n  outfile: 'dist/bundle.js',\n  bundle: true,\n  plugins: [glsl({\n    minify: true,\n    resolveIncludes: true\n  })]\n});","lang":"typescript","description":"Shows basic esbuild build with the glsl plugin, enabling minification and include resolution for shader files."},"warnings":[{"fix":"Use import statement and set module to ESM or use dynamic import.","message":"Plugin is ESM-only since v1.0.0; CommonJS require() will fail.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Pin esbuild to 0.x.x in package.json.","message":"Requires esbuild 0.x.x as peer dependency; incompatible with esbuild 1.x.x.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Add a shaders.d.ts file with module declarations as shown in README.","message":"Shader files are imported as default exports (string), but TypeScript may complain without type declarations.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Explicitly set minify: true in plugin options.","message":"The minify option follows esbuild's minify setting by default, which may be false even if you set it true in the plugin.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Run 'npm install esbuild-plugin-glsl' and ensure it's in package.json.","cause":"Package not installed or not included in dependencies.","error":"Error: Cannot find module 'esbuild-plugin-glsl'"},{"fix":"Use import { glsl } from 'esbuild-plugin-glsl'.","cause":"Incorrect import; importing default instead of named export.","error":"Error: The esbuild plugin 'esbuild-plugin-glsl' must be an object with a 'name' and 'setup' function."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}