@m00nbyte/rollup-plugin-strip-prop-types
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

rollup-plugin-strip-prop-types

npm version npm downloads


Features

  • Remove propTypes and defaultProps statements from react components
  • Remove require and import statements for the prop-types package
  • Custom import paths
  • TypeScript support

Installation

npm install -D @m00nbyte/rollup-plugin-strip-prop-types
yarn add -D @m00nbyte/rollup-plugin-strip-prop-types

Usage

// rollup.config.js
import stripPropTypes from '@m00nbyte/rollup-plugin-strip-prop-types';

export default {
    plugins: [
        stripPropTypes({
            include: ['**/*.jsx', '**/*.tsx'],
            exclude: ['node_modules/**'],
            imports: ['/some_other_module'],
            sourceMap: true
        })
    ]
};

Options

include

Type: String | RegExp | Array[...String|RegExp] Default: ['**/*.jsx', '**/*.tsx']

A picomatch pattern, or array of patterns, which specifies the files in the build the plugin should operate on. If defined, it will overwrite the default values.

exclude

Type: String | RegExp | Array[...String|RegExp] Default: ['node_modules/**']

A picomatch pattern, or array of patterns, which specifies the files in the build the plugin should ignore. If defined, it will overwrite the default values.

imports

Type: Array[...String] Default: ['prop-types']

By default only require and import statements for the prop-types package are removed. Additional module paths can be defined. These paths will be merged with the default values without duplicates.

sourceMap

Type: Boolean Default: true

Set to false if source maps are not used.

Contribution

Feel free to submit issues or pull requests.

Like my work?

This project needs a ⭐ from you. Don't forget to leave a star.

Buy Me A Coffee

Package Sidebar

Install

npm i @m00nbyte/rollup-plugin-strip-prop-types

Weekly Downloads

2

Version

1.0.3

License

MIT

Unpacked Size

12.5 kB

Total Files

12

Last publish

Collaborators

  • m00nbyte