babel-plugin-transform-react-remove-prop-types
babel-plugin-transform-react-remove-prop-types copied to clipboard
Remove unnecessary React propTypes from the production build. :balloon:
I wonder if we shouldn't port this plugin to https://swc.rs/docs/usage/plugins. It could unlock the support of https://nextjs.org/docs/messages/swc-disabled.
For all of the following examples, `propTypes` are incorrectly not removed: ```jsx import PropTypes from 'prop-types'; export default function Foo({ children }) { return children(); } Foo.propTypes = { children:...
My .babelrc has 2 environments that are used for differential serving: "env": { "modern": { "presets": [ [ "@babel/preset-env", { "targets": { "esmodules": true } } ], "@babel/preset-react", "@babel/preset-flow" ],...
Code (TypeScript): ```ts import React, { Component } from 'react'; export class Foobar extends Component { static propTypes: {}; render() { return null; } } Foobar.propTypes = {}; ``` Config:...
```js const myComp = React.forwardRef(() => {...}); myComp.propTypes = {}; ``` ```js const context = React.createContext(); context.provider.propTypes = {} ``` - The former doesn't work, but I am guessing could...
I just found out an issue regarding the option `"removeImport": true` like I got a following snippet function: ```javascript function foo(arg, list) { switch (arg) { case 0: { const...
Sometimes you may want to remove propTypes for production build, but sometimes not. For example when your library is imported in storybook, you want not to remove propTypes, because storybook...
How can I include only certain filenames, or ignore all filenames except files X, Y, Z? I tried `/^((?!file-X).)*$/` regex in `ignoreFilenames` but that didn't do the trick
I found that the plugin had issues when used with `createReactClass` example: ``` var SelectBox = createReactClass({ propTypes: { value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), selectId: PropTypes.string.isRequired, fullwidth: PropTypes.bool.isRequired }, ... }); ```...
Hi @oliviertassinari ! Thank you for such a great plugin! It makes our app much more performant in production. Unfortunately, it doesn't work with latest version of `react-navigation` library or...