{"id":19147,"library":"babel-plugin-remove-glsl-comments","title":"babel-plugin-remove-glsl-comments","description":"Babel plugin that removes GLSL comments (single-line // and block /* */) from shader source strings at build time. Current stable version: 1.0.0. Infrequently updated. Differentiators: designed specifically for GLSL within JavaScript, integrates with Babel pipeline, avoids runtime comment stripping. Alternative to manual regex or build-step scripts.","status":"active","version":"1.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/uber/luma.gl","tags":["javascript","babel-plugin","webgl","glsl"],"install":[{"cmd":"npm install babel-plugin-remove-glsl-comments","lang":"bash","label":"npm"},{"cmd":"yarn add babel-plugin-remove-glsl-comments","lang":"bash","label":"yarn"},{"cmd":"pnpm add babel-plugin-remove-glsl-comments","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"This is a Babel plugin; import the default export to use in .babelrc or babel.config.js as a plugin string.","wrong":"const { default } = require('babel-plugin-remove-glsl-comments')","symbol":"default","correct":"import removeGlslComments from 'babel-plugin-remove-glsl-comments'"},{"note":"CommonJS users must access .default because the module exports an ES module default.","wrong":"const removeGlslComments = require('babel-plugin-remove-glsl-comments')","symbol":"removeGlslComments","correct":"const removeGlslComments = require('babel-plugin-remove-glsl-comments').default"},{"note":"When using string shorthand in Babel config, omit the 'babel-plugin-' prefix; Babel resolves it automatically.","wrong":"\"plugins\": [\"babel-plugin-remove-glsl-comments\"]","symbol":"babel plugin usage","correct":"\"plugins\": [\"remove-glsl-comments\"]"}],"quickstart":{"code":"// babel.config.js\nmodule.exports = {\n  plugins: [\n    ['module:remove-glsl-comments', { /* options */ }],\n  ],\n};\n\n// sample.js (transformed)\nconst vertexShader = `\n  // vertex shader\n  attribute vec3 position; // position attribute\n  void main() {\n    gl_Position = vec4(position, 1.0);\n  }\n`;\n// After plugin: comments removed, GLSL preserved","lang":"javascript","description":"Shows how to configure the Babel plugin in babel.config.js and the expected transformation on a GLSL string."},"warnings":[{"fix":"Ensure GLSL code does not contain nested block comments; remove them manually.","message":"Plugin is not designed to handle complex GLSL preprocessor directives or nested comments (GLSL spec does not allow nested blocks).","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Consider migrating to luma.gl's shader module system if using WebGL.","message":"Package may be deprecated in favor of using @luma.gl/shadertools or inline build tool plugins.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Ensure the plugin is included in the Babel config for files that contain GLSL strings.","message":"Plugin only removes comments from GLSL strings, not from arbitrary JavaScript code. It must be applied to files containing GLSL template literals.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run 'npm install babel-plugin-remove-glsl-comments --save-dev' and verify package.json.","cause":"Package not installed or misspelled in config.","error":"Error: Cannot find module 'babel-plugin-remove-glsl-comments'"},{"fix":"Replace 'const plugin = require('babel-plugin-remove-glsl-comments')' with 'const plugin = require('babel-plugin-remove-glsl-comments').default'.","cause":"Using require() without .default in CommonJS.","error":"TypeError: (intermediate value) is not a function"},{"fix":"Ensure the package is installed and use the full module path: 'module:remove-glsl-comments' or the shorthand 'remove-glsl-comments'.","cause":"Incorrect plugin specifier in Babel config.","error":"Error: Babel plugin 'remove-glsl-comments' specified in \"plugins\" but not found."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}