Registry / web-framework / babel-plugin-remove-glsl-comments

babel-plugin-remove-glsl-comments

JSON →
library1.0.0jsnpmunverified

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.

npm install babel-plugin-remove-glsl-comments
INSTALL
IMPORT
SIG · BABEL-PLUGIN-REMOV
B
babel-plugin-remove-glsl-comments
web-frameworkjavascriptv1.0.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import removeGlslComments from 'babel-plugin-remove-glsl-comments'
const { default } = require('babel-plugin-remove-glsl-comments')
This is a Babel plugin; import the default export to use in .babelrc or babel.config.js as a plugin string.
removeGlslComments
const removeGlslComments = require('babel-plugin-remove-glsl-comments').default
const removeGlslComments = require('babel-plugin-remove-glsl-comments')
CommonJS users must access .default because the module exports an ES module default.
babel plugin usage
"plugins": ["remove-glsl-comments"]
"plugins": ["babel-plugin-remove-glsl-comments"]
When using string shorthand in Babel config, omit the 'babel-plugin-' prefix; Babel resolves it automatically.

Shows how to configure the Babel plugin in babel.config.js and the expected transformation on a GLSL string.

// babel.config.js module.exports = { plugins: [ ['module:remove-glsl-comments', { /* options */ }], ], }; // sample.js (transformed) const vertexShader = ` // vertex shader attribute vec3 position; // position attribute void main() { gl_Position = vec4(position, 1.0); } `; // After plugin: comments removed, GLSL preserved
Debug
Known issues
breakingPlugin is not designed to handle complex GLSL preprocessor directives or nested comments (GLSL spec does not allow nested blocks).
fix
Ensure GLSL code does not contain nested block comments; remove them manually.
affects: >=1.0.0
deprecatedPackage may be deprecated in favor of using @luma.gl/shadertools or inline build tool plugins.
fix
Consider migrating to luma.gl's shader module system if using WebGL.
affects: >=1.0.0
gotchaPlugin only removes comments from GLSL strings, not from arbitrary JavaScript code. It must be applied to files containing GLSL template literals.
fix
Ensure the plugin is included in the Babel config for files that contain GLSL strings.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'babel-plugin-remove-glsl-comments'
Package not installed or misspelled in config.
fix
Run 'npm install babel-plugin-remove-glsl-comments --save-dev' and verify package.json.
TypeError: (intermediate value) is not a function
Using require() without .default in CommonJS.
fix
Replace 'const plugin = require('babel-plugin-remove-glsl-comments')' with 'const plugin = require('babel-plugin-remove-glsl-comments').default'.
Error: Babel plugin 'remove-glsl-comments' specified in "plugins" but not found.
Incorrect plugin specifier in Babel config.
fix
Ensure the package is installed and use the full module path: 'module:remove-glsl-comments' or the shorthand 'remove-glsl-comments'.
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
9 hits · last 30 days
node
8
OpenAI (training)
1
Resources
babel-plugin-remove-glsl-comments — npm install babel-plugin-remove-glsl-comments · libregistry