rollup-plugin-jsx-remove-attributes weekly downloads statistics
By jacobbogers · npm · Vite plugins
rollup & vite plugin to remove jsx attributes
rollup-plugin-jsx-remove-attributes has 4,263 recorded weekly downloads on npm, a decrease of 94.5% over the past 30 days, ranking #1174 of 2,322 tracked listings.
About rollup-plugin-jsx-remove-attributes
rollup(& vite)-plugin-jsx-remove-attributes
rollup & vite plugin to remove jsx attributes
This plugin can be used in vite or rollup.
The initial motivation was to remove data-testid attributes from jsx (react, etc) components.
It can be generally used to remove any number of attributes.
The plugin only runs when NODE_ENV matches the values of the environments option (default is ['production']).
Table of contents
<!-- vscode-markdown-toc --> <!-- vscode-markdown-toc-config numbering=true autoSave=true /vscode-markdown-toc-config --> <!-- /vscode-markdown-toc -->1. <a name='Installation'></a>Installation
npm i -D rollup-plugin-jsx-remove-attributes
2. <a name='UsagewithVite'></a>Usage with Vite
Example:
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import removeTestIdAttribute from 'rollup-plugin-jsx-remove-attributes';
export default defineConfig({
build: { sourcemap: true },
plugins: [
react(),
removeTestIdAttribute({
include: [/\.[tj]sx$/], //default
exclude: ['**/node_modules/**'], // default
attributes: ['data-testid'], // default, array of attribute names to strip from jsx
environments: ['production', 'pre-prod', 'prod', 'q&a'], // default = ["production"]
debug: false, // is the default, if "true" show more logging of the internal workings of this plugin, for troubleshooting configs
usage: 'vite' // Must specify for vite use, default usage is rollup
})
// other plugins
]
});
3. <a name='UsagewithRollup'></a>Usage with Rollup
Example:
import { rollup } from 'rollup';
import removeTestIdAttribute from 'rollup-plugin-jsx-remove-attributes';
// see below for details on these options
const inputOptions = {
...
plugins:[
removeTestIdAttribute({
include: [/\.[tj]sx$/], //default
exclude: ['**/node_modules/**'], // default
attributes: ['data-testid'], // default, array of attribute names to strip from jsx
environments: ['production', 'pre-prod', 'prod', 'q&a'], // default = ["production"]
debug: false, // is the default, if "true" show more logging of the internal workings of this plugin, for troubleshooting configs
usage: 'rollup' // default, when configuring for rollup "usage" can be omitted, shown for clarity only
}),
]
};
const outputOptions = {...};
const bundle = await rollup.build(inputOptions);
await rollup.write(outputOptions);
4. <a name='OptionsObject'></a>Options Object
usage: defaultrollup, possible values areviteorrollup,include: default[/\.[tj]sx$/], will allow anything that matches the array of glob/regexp pattern, default[/\.[tj]sx$/]exclude: default['**/node_modules/**'], will exclude anything matching the array of glob/regexp patternsattributes: (optional default = [data-testid] ) array of jsx attributes to be stripped if foundenvironments: array of strings representing values of NODE_ENV for wich this plugin will run.debug: defaultfalse, show more logging of internal workings of the plugin, default false
5. <a name='UsagewithPreact'></a>Usage with Preact
Preact is now supported since version 3.1.0
Please take care the insert this plugin before any minification/uglify plugin.
For example:
// imports removed for brevity
//
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
esbuild(),
jsxRemoveAttributes(), // <-- this plugin
minify()
],
//
// other config info removed for brevity
});
For more information see issue
6. <a name='UsagewithBabel'></a>Usage with Babel
Since version 3.1.2 supporting runtime injections of @babel/plugin-transform-react-jsx. (this PR).
Description from the npm listing.
- vite-plugin
- rollup-plugin
- data-testid
- remove attribute
README badge
Show your rank in a README or on your website. The badge updates automatically.
Charts
Images: 30d · 1y · all time · 1600×900 dark
Adoption over time
7/30/90-day growth
Ranking history
Listing placement
Listing placement
Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.
Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.
Recent observations
Full history (544)Similar npm Vite plugins plugins
All 20 rollup-plugin-jsx-remove-attributes alternativesData source
Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.
Listing: https://www.npmjs.com/package/rollup-plugin-jsx-remove-attributes. First seen Oct 16, 2026; last successful collection Oct 20, 2026. See the methodology.