A Rollup plugin that allows importing GLSL shader files (e.g., .glsl, .vert, .frag) as JavaScript strings, processed through glslify — a Node.js-style module system for GLSL. It supports include/exclude patterns, optional compression via glslify's minifier, and is TypeScript-compatible (ships types). Current stable is 1.3.1, with maintenance releases as needed. Differentiators: integrates glslify's modular shader system into Rollup builds, supports compression, and is part of the glslify ecosystem. Compared to raw string loaders, it resolves glslify imports and applies transforms.
npm install rollup-plugin-glslifyVerified import paths — ran on the pinned version, not inferred.
Shows a Rollup config using the plugin with include/exclude and compression, plus importing a .frag file.
Update custom transforms to return a string directly instead of using through2.
Set compress: false in development config, and only enable for production builds.
Explicitly set include to only the extensions you need, e.g., include: ['**/*.glsl'].
Manually add source map support via a separate Rollup plugin or use glslify's --sourcemap flag.
Run 'npm install glslify' alongside rollup-plugin-glslify.
Use default import: import glslify from 'rollup-plugin-glslify'
Add .glsl to the include option or verify the file extension matches the pattern.
Check the import path in the GLSL file and ensure it exists.