bpr

babel-plugin-remove-react-jsx-attribute

Remove HTML attributes when bundling by Webpack

Showing:

Popularity

Downloads/wk

0

GitHub Stars

8

Maintenance

Last Commit

2mos ago

Contributors

1

Package

Dependencies

0

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

babel-plugin-remove-react-jsx-attribute

Installation

npm install --save-dev babel-plugin-remove-react-jsx-attribute

yarn add -D babel-plugin-remove-react-jsx-attribute

Introduction

This is useful to remove the JSX attribute which isn't necessary to transpile. For instance, You can easily remove 'data-testid' just for testing.

Example

  • input
function Element() {
  return <div className="app" data-testid="custom-element" />;
}
  • output
function Element() {
  return <div className="app" />;
}

Usage

Add plugin to .babelrc or webpack.config.js babel options The format of attributes should be consist of string or regular expression.

plugins: [
  ...
  ["babel-plugin-remove-react-jsx-attribute", { attributes: ["data-testid",  /^(data-)/]}]
]

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100