Ramda: importing error when [email protected] with webpack

Created on 27 Oct 2017  路  3Comments  路  Source: ramda/ramda

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 !!!

Most helpful comment

import * as _ from 'ramda'

All 3 comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cjohansen picture cjohansen  路  4Comments

kostenko picture kostenko  路  3Comments

zhaoyao91 picture zhaoyao91  路  3Comments

sugoidesune picture sugoidesune  路  3Comments

woss picture woss  路  3Comments