Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

react-apollo beta won't minify with create-react-app build process #1734

Closed
tavelli opened this issue Feb 28, 2018 · 15 comments
Closed

react-apollo beta won't minify with create-react-app build process #1734

tavelli opened this issue Feb 28, 2018 · 15 comments

Comments

@tavelli
Copy link

tavelli commented Feb 28, 2018

Intended outcome:
npm run build compiles code

Actual outcome:
get the following build error

Failed to minify the code from this file:
./node_modules/react-apollo/parser.mjs:13
Read more here: http://bit.ly/2tRViJ9

How to reproduce the issue:
have a basic create-react-app, add react-apollo beta and try to run "build" script.

https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md#npm-run-build-fails-to-minify

Version
"react-apollo": "2.1.0-beta.3"

@dsummersja
Copy link

solved by reverting version to "2.0.4", deleting node_modules, yarn/npm install -> run build

@tavelli
Copy link
Author

tavelli commented Feb 28, 2018

ok i figured it had to do with beta, but i just started building a new app based off latest docs using apollo-boost and the newer components like <Query> so theres no going backwards for me 😄

@bestmikelee
Copy link

had to just comment out the uglify plugin (line 291) in ./node_modules/react-scripts/config/webpack.config.prod.js to build and keep going for now.

@pantharshit00
Copy link

pantharshit00 commented Mar 4, 2018

This needs to be fixed soon. I can even build.

This failed.
https://app.netlify.com/sites/agitated-mclean-b4bf7d/deploys/5a9b982448769b4c8348c815

@bodia-uz
Copy link

bodia-uz commented Mar 4, 2018

@tavelli you could revert to 2.1.0-beta.2. CRA has not build problem with this version

@tavelli
Copy link
Author

tavelli commented Mar 7, 2018 via email

@fabien0102
Copy link

Just for the record, I have the kind of error on 2.1.0-beta.2 if I have an instance of Subscription from 'react-apollo/Subscriptions'

image

@fabien0102
Copy link

Quick & dirty fix:

// package.json
"scripts": {
    "fix-react-apollo": "rimraf ./node_modules/react-apollo/*.mjs",
    "build": "npm run fix-react-apollo && react-scripts build"
  },

Just removing all the *.mjs files in react-apollo and no more problems! 🎉

@excitement-engineer
Copy link
Contributor

This is being fixed in CRA in facebook/create-react-app#4085

@excitement-engineer
Copy link
Contributor

excitement-engineer commented Mar 10, 2018

@jbaxleyiii seems to have fixed this in #1769. I expect there to be a new release containing the fix soon.

@tavelli
Copy link
Author

tavelli commented Mar 15, 2018

@excitement-engineer just tested with 2.1.0-rc.3, working great!

@tavelli tavelli closed this as completed Mar 15, 2018
@gaearon
Copy link

gaearon commented Apr 3, 2018

If your project is built with Create React App and not ejected, react-scripts@1.1.2 should fix this.
Here is how to upgrade:

https://github.com/facebook/create-react-app/releases/tag/v1.1.2

Otherwise you can apply a similar fix yourself in your project config. Cheers!

@mjasnikovs
Copy link

mjasnikovs commented Apr 6, 2018

@gaearon did not fixed, i had to downgrade to react-apollo@2.1.1

@andrwsalcdo
Copy link

For others,

I tried the other solutions. But, only @fabien0102's solution worked for me.

version:
"react-apollo": "^2.1.0-beta.3",

@keishon104
Copy link

I did "yarn install" and the error disappeared for me.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests