Registry /
devops / rollup-plugin-jsx-remove-attributes
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
muslnode 18–223 runs
build_error
glibcnode 18–223 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
removeTestIdAttribute
✓ import removeTestIdAttribute from 'rollup-plugin-jsx-remove-attributes'
✗ import { removeTestIdAttribute } from 'rollup-plugin-jsx-remove-attributes'
Default export; named import will fail. ESM-only (no CJS).
removeTestIdAttribute
✓ const removeTestIdAttribute = require('rollup-plugin-jsx-remove-attributes')
✗ const { removeTestIdAttribute } = require('rollup-plugin-jsx-remove-attributes')
In CJS, use default require; destructuring will give undefined.
PluginOptions
✓ import type { PluginOptions } from 'rollup-plugin-jsx-remove-attributes'
Type import for TypeScript users.
Configures Vite to remove 'data-testid' and 'data-cy' attributes from JSX in production builds.
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import removeTestIdAttribute from 'rollup-plugin-jsx-remove-attributes';
export default defineConfig({
plugins: [
react(),
removeTestIdAttribute({
include: [/\.tsx$/],
exclude: ['node_modules/**'],
attributes: ['data-testid', 'data-cy'],
environments: ['production', 'staging'],
usage: 'vite'
})
]
});
Errors
Common errors & fixes
TypeError: removeTestIdAttribute is not a function
Using named import instead of default import
fixChange to: import removeTestIdAttribute from 'rollup-plugin-jsx-remove-attributes'
Error: The plugin only works when NODE_ENV is set to 'production' or specified environments.
NODE_ENV not set or not in environments array
fixEnsure NODE_ENV=production or adjust environments option.
ENOENT: no such file or directory, open '.../node_modules/rollup-plugin-jsx-remove-attributes/package.json'
Missing or incomplete installation
fixRun npm install again and verify peer dependencies.
Audit
Dependencies
@rollup/pluginutilsrequiredFiltering files by include/exclude patterns
astringrequiredAST node manipulation to remove attributes
estree-walkerrequiredWalking the ESTree AST
viteoptionalRequired when usage is 'vite'