Trying to import react-image-crop
package using yarn and add it to react boilerplate
.
After installing the package getting this error
Module parse failed: /Users/...../frontend/node_modules/react-image-crop/lib/ReactCrop.js Unexpected token (62:25)
You may need an appropriate loader to handle this file type.
|
| function makeAspectCrop(crop, imageAspect) {
| const completeCrop = { ...crop };
|
| if (crop.width) {
@ ./app/components/ImageUpload/index.js 23:0-41
@ ./app/containers/HomePage/index.js
@ ./app/containers/HomePage/Loadable.js
@ ./app/containers/App/index.js
@ ./app/app.js
@ multi eventsource-polyfill webpa
The boilerplate is using babylons env
preset so the spread operator should be available.
Any ideas what may be the cause?
Instead of importing directly from react-image-crop
I used
import ReactCrop from 'react-image-crop/dist/ReactCrop';
and working like a charm
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.