From b41fe4efb16859bd17c1f9755dcf5d1547ee1ac0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Burzy=C5=84ski?= Date: Wed, 9 Aug 2017 15:45:02 +0200 Subject: [PATCH] =?UTF-8?q?[docs]=20Added=20clarification=20note=20about?= =?UTF-8?q?=20transform-react-inline-elements=20usage=20=E2=80=A6=20(#6078?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Added clarification note about transform-react-inline-elements usage with transform-runtime [skip ci] * small tweaks [skip ci] --- .../README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/babel-plugin-transform-react-inline-elements/README.md b/packages/babel-plugin-transform-react-inline-elements/README.md index 8893106af4..5e48626f0a 100644 --- a/packages/babel-plugin-transform-react-inline-elements/README.md +++ b/packages/babel-plugin-transform-react-inline-elements/README.md @@ -2,6 +2,16 @@ > Replaces the `React.createElement` function with one that is more optimized for production: `babelHelpers.jsx`. +## Note + +When used alongside `transform-runtime`, polyfills (by default including `Symbol`) are specifically scoped to not pollute the global scope. This breaks usage with React, as it won't have access to that polyfill and will cause your application to fail in legacy browsers. + +Even if `['transform-runtime', { helpers: true, polyfill: false }]` is specified, it might still break, since `helpers` come precompiled. + +In this case, we recommend importing/requiring `babel-polyfill` in the entry point of your application and using `babel-preset-env` with the `useBuiltIns` option to only include the polyfills your targets need. Alternatively, you can also import/require `core-js/modules/es6.symbol` by itself. + +This transform **should be enabled only in production** (e.g., just before minifying your code) because, although it improves runtime performance, it makes warning messages more cryptic and skips important checks that happen in development mode, including propTypes. + ## Example **In**