You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
babel-preset-react-app, babel 7 for component library #5443
I'm using babel-preset-react-app to transpile a npm package with just babel that I'm consuming in a CRA app.
It worked well with babel-preset-react-app@3.1.1 and babel@6, but when I updated to babel-preset-react-app@5.0.3 and babel@7 the output build contained relative imports for babel stuff instead on inlining the functions
Before upgrade:
function_objectWithoutProperties(obj,keys){vartarget={};for(variinobj){if(keys.indexOf(i)>=0)continue;if(!Object.prototype.hasOwnProperty.call(obj,i))continue;target[i]=obj[i];}returntarget;}function_classCallCheck(instance,Constructor){if(!(instanceinstanceofConstructor)){thrownewTypeError("Cannot call a class as a function");}}importReact,{Component}from'react';
We are releasing a component library using the same method and struggled with this for a few hours as well. We are using the react-app preset in our .babelrc.
We solved the issue by configuring the react-app preset to avoid generating absolute paths for @babel/runtime, like this:
Activity
simonedavico commentedon Oct 16, 2018
We are releasing a component library using the same method and struggled with this for a few hours as well. We are using the
react-apppreset in our.babelrc.We solved the issue by configuring the
react-apppreset to avoid generating absolute paths for@babel/runtime, like this:This requires having
@babel/runtimeas a dependency in ourpackage.json.bogdansoare commentedon Oct 16, 2018
@simonedavico awesome, thank you very much for this explanation 🙏
iddan commentedon Nov 17, 2018
Can
absoluteRuntimeappear in docs?Timer commentedon Nov 17, 2018
Send a PR. 😄
iddan commentedon Nov 17, 2018
Done #5847