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

Add an option for adding NODE_ENV checks for minifiers #154

Open
3 of 5 tasks
sohkai opened this issue Dec 16, 2017 · 3 comments
Open
3 of 5 tasks

Add an option for adding NODE_ENV checks for minifiers #154

sohkai opened this issue Dec 16, 2017 · 3 comments

Comments

@sohkai
Copy link

sohkai commented Dec 16, 2017

Consumers of a library should be able to access the library's proptypes in dev builds, but then be able to seamlessly strip them out for production.

See conversation on #70 (comment).

TODO:

  • add deadCode config option (see readme)
  • dce for the propTypes object
  • dce for exported types (export type Foo =)
  • dce for imported types (import type {Foo} from './Foo)
  • dce for the actual 'propTypes' property, both with the default assignment at end of file, and the the useStatic option (currently propTypes=null after minify)
@dlebedynskyi
Copy link

Hi, tried dead code and running into issues with deadCode: true

Error: Error: No substitution given for "NODE_ENV". If this is not meant to be a
            placeholder you may want to consider passing one of the following options to @babel/template:
            - { placeholderPattern: false, placeholderWhitelist: new Set(['NODE_ENV'])}
            - { placeholderPattern: /^NODE_ENV$/ }

any suggestion on fix?

@brigand
Copy link
Owner

brigand commented Sep 4, 2018

@dlebedynskyi Thanks for the report, should be fixed in 24.1.2

@dlebedynskyi
Copy link

@brigand confirmed, working now. Thank you

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

No branches or pull requests

3 participants