Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove propTypes import in prod build #3085

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

praveenreddy1798
Copy link

@praveenreddy1798 praveenreddy1798 commented Jan 15, 2023

Description

Remove prop-types imported to prod build

import PropTypes from ‘prop-types’
The above gets added in the prod build.

transform-react-remove-prop-types in the babel config removes the propTypes added but fails to remove the propTypes imported at the top of the scope.

It requires removeImport: true configuration in transform-react-remove-prop-types to be able to remove the propTypes import at the top of scope

Steps to reproduce

  1. Add @babel/cli package to be able to test the babel config.
    npm install @babel/cli --save-dev
    (or)
    yarn add -D @babel/cli

  2. Set the NODE_ENV to production
    This is required to test the configs for production
    export NODE_ENV=production

  3. Choose a file that you would like test
    I have chosen the index.js file in app/containers/HomePage directory

  4. Use babel to execute the file
    npx babel app/containers/HomePage/index.js

Screenshots

With dev branch
Screenshot 2023-01-15 at 1 17 26 PM

With changes fixed in PR
Screenshot 2023-01-15 at 1 16 31 PM

@praveenreddy1798 praveenreddy1798 changed the title fix: remove propTypes import to prod build fix: remove propTypes import in prod build Jan 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant