when I write some reactjs code using [email protected] with webpack, I encountered an error:
Uncaught TypeError: Cannot read property 'map' of undefined
here's my simple test code:
import _ from 'ramda';
import React from 'react'
const Main = () => (
<div>
{_.map([])}
Welcome!
</div>
);
and the webpack Warning log is :
export 'default' (imported as '_') was not found in 'ramda'
there's no such error several weeks before,so I removed 0.25.0 and only tried [email protected] with the same code , no more changed absolutely. then it's ok ..... error disappeared
btw: I have tried "react-scripts": "^1.0.2" in package.json or with myself's webpack.config.js ,the result is the same , so there's no error in webpack I guess.
so, what magic happend when ramda0.24.1 upgrade to 0.25.0?
hope anybody can find out and explain this, thank you so much !!!
import * as _ from 'ramda'
@adispring thanks,this worked! just searching for more explanation
You can see this issue for the explanation: https://github.com/ramda/ramda/issues/2322.
For a brief, because es6 and tree shaking, ramda v0.25.0 does not export the default value out of the module.
Most helpful comment
import * as _ from 'ramda'