ankane / react-chartkick

Create beautiful JavaScript charts with one line of React
https://chartkick.com/react
MIT License
1.2k stars 58 forks source link

Create-React-App Fails to Minify #14

Closed ilrein closed 6 years ago

ilrein commented 6 years ago

The aforementioned toolset for spinning up React apps fails to compile for production this package.

The exact message:

Creating an optimized production build...
Failed to compile.

Failed to minify the code from this file: 

    ./~/react-chartkick/index.js:14 

Looking at the code, it seems to throw an err at the first arrow function:

var createComponent = (chartType) => {

It's referenced in the README to this issue: https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#npm-run-build-fails-to-minify

Basically the package is published and the "main" of package.json references the non-babel transpiled code. This package won't work unless an ES5 version is the main export.

ankane commented 6 years ago

Hey @ilrein, thanks for the detailed report 💯 Fixed on master. Will push out a new release later tonight.

BernardoFBBraga commented 6 years ago

hey @ankane I'm getting this error on 0.1.7 however the error points to ./node_modules/chartkick/src/helpers.js:15 I'm not sure if I should go to chartkick to request this as they are not really concerend about react and create-react-app

BernardoFBBraga commented 6 years ago

just realized both projects are yours

ankane commented 6 years ago

Make sure you’re on the latest chartkick (2.3.4)

ankane commented 6 years ago

Fixed in https://github.com/ankane/chartkick.js/pull/97

BernardoFBBraga commented 6 years ago

Github says last version is 2.3.3, which confused me. I updated the package.json and it worked thanks

ankane commented 6 years ago

Where does it show that?