https://github.com/m00nbyte/rollup-plugin-strip-prop-types
Removes propTypes, defaultProps, and prop-types imports, with TypeScript support and custom import paths
https://github.com/m00nbyte/rollup-plugin-strip-prop-types
Last synced: about 2 months ago
JSON representation
Removes propTypes, defaultProps, and prop-types imports, with TypeScript support and custom import paths
- Host: GitHub
- URL: https://github.com/m00nbyte/rollup-plugin-strip-prop-types
- Owner: m00nbyte
- License: mit
- Created: 2024-06-03T22:47:01.000Z (11 months ago)
- Default Branch: master
- Last Pushed: 2024-06-04T21:31:34.000Z (11 months ago)
- Last Synced: 2024-08-10T09:59:34.501Z (9 months ago)
- Language: TypeScript
- Size: 89.8 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome - strip-prop-types - Removes propTypes, defaultProps, and prop-types imports, with TypeScript support and custom import paths. (Plugins / Output)
README
# rollup-plugin-strip-prop-types
[](https://www.npmjs.org/package/@m00nbyte/rollup-plugin-strip-prop-types) [](https://www.npmjs.org/package/@m00nbyte/rollup-plugin-strip-prop-types)
---
## 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
```bash
npm install -D @m00nbyte/rollup-plugin-strip-prop-types
yarn add -D @m00nbyte/rollup-plugin-strip-prop-types
```## Usage
```js
// 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](https://github.com/micromatch/picomatch), 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](https://github.com/micromatch/picomatch), 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 :star: from you.
Don't forget to leave a star.## [Changelog](CHANGELOG.md)
## [License](LICENSE)