Skip to content

Commit

Permalink
explain in README how to exclude prop-types
Browse files Browse the repository at this point in the history
  • Loading branch information
nolanlawson committed Mar 8, 2019
1 parent ff0cc84 commit 290c284
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 16 deletions.
11 changes: 1 addition & 10 deletions .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,7 @@

"transform-object-rest-spread",
"transform-runtime",
[
"transform-react-remove-prop-types",
{
"removeImport": true,
"additionalLibraries": [
"../utils/shared-props",
"../../utils/shared-props"
]
}
],
"transform-react-remove-prop-types",
[
"transform-define", "scripts/define.js"
],
Expand Down
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,32 @@ Apple / Google / Twitter / EmojiOne / Messenger / Facebook
## Not opinionated
**Emoji Mart** doesn’t automatically insert anything into a text input, nor does it show or hide itself. It simply returns an `emoji` object. It’s up to the developer to mount/unmount (it’s fast!) and position the picker. You can use the returned object as props for the `EmojiMart.Emoji` component. You could also use `emoji.colons` to insert text into a textarea or `emoji.native` to use the emoji.

## Removing prop-types in production

To remove [prop-types](/~https://github.com/facebook/prop-types) in production, use [babel-plugin-transform-react-remove-prop-types](/~https://github.com/oliviertassinari/babel-plugin-transform-react-remove-prop-types):

```bash
npm install --save-dev babel-plugin-transform-react-remove-prop-types
```

Then add to your `.babelrc`:

```json
"plugins": [
/* ... */
[
"transform-react-remove-prop-types",
{
"removeImport": true,
"additionalLibraries": [
"../../utils/shared-props"
]
}
]
```

You'll also need to ensure that Babel is transpiling `emoji-mart`, e.g. [by not excluding `node_modules` in `babel-loader`](/~https://github.com/babel/babel-loader#usage).

## Development
```sh
$ yarn build
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"babel-plugin-transform-define": "^1.3.0",
"babel-plugin-transform-es2015-destructuring": "6.9.0",
"babel-plugin-transform-object-rest-spread": "6.8.0",
"babel-plugin-transform-react-remove-prop-types": "^0.4.21",
"babel-plugin-transform-react-remove-prop-types": "^0.4.8",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-es2015": "6.6.0",
"babel-preset-react": "6.5.0",
Expand Down
12 changes: 7 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1345,10 +1345,12 @@ babel-plugin-transform-react-jsx@6.24.1, babel-plugin-transform-react-jsx@^6.24.
babel-plugin-syntax-jsx "^6.8.0"
babel-runtime "^6.22.0"

babel-plugin-transform-react-remove-prop-types@^0.4.21:
version "0.4.21"
resolved "https://registry.yarnpkg.com/babel-plugin-transform-react-remove-prop-types/-/babel-plugin-transform-react-remove-prop-types-0.4.21.tgz#0087938f4348cb751b3e5055a6b38f3c61b5231b"
integrity sha512-+gQBtcnEhYFbMPFGr8YL7SHD4BpHifFDGEc+ES0+1iDwC9psist2+eumcLoHjBMumL7N/HI/G64XR5aQC8Nr5Q==
babel-plugin-transform-react-remove-prop-types@^0.4.8:
version "0.4.8"
resolved "https://registry.yarnpkg.com/babel-plugin-transform-react-remove-prop-types/-/babel-plugin-transform-react-remove-prop-types-0.4.8.tgz#0aff04bc1d6564ec49cf23bcffb99c11881958db"
integrity sha1-Cv8EvB1lZOxJzyO8/7mcEYgZWNs=
dependencies:
babel-traverse "^6.25.0"

babel-plugin-transform-regenerator@6.24.1:
version "6.24.1"
Expand Down Expand Up @@ -1675,7 +1677,7 @@ babel-template@^6.24.1, babel-template@^6.26.0, babel-template@^6.7.0:
babylon "^6.18.0"
lodash "^4.17.4"

babel-traverse@^6.24.1, babel-traverse@^6.26.0, babel-traverse@^6.7.2:
babel-traverse@^6.24.1, babel-traverse@^6.25.0, babel-traverse@^6.26.0, babel-traverse@^6.7.2:
version "6.26.0"
resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-6.26.0.tgz#46a9cbd7edcc62c8e5c064e2d2d8d0f4035766ee"
integrity sha1-RqnL1+3MYsjlwGTi0tjQ9ANXZu4=
Expand Down

0 comments on commit 290c284

Please sign in to comment.