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"
solved by reverting version to "2.0.4", deleting node_modules, yarn/npm install -> run build
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 😄
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.
This needs to be fixed soon. I can even build.
This failed.
https://app.netlify.com/sites/agitated-mclean-b4bf7d/deploys/5a9b982448769b4c8348c815
@tavelli you could revert to 2.1.0-beta.2. CRA has not build problem with this version
Ok thanks that's good tip. I don't need to build and deploy quite yet just
wanted to raise it so hopefully will be fixed before 2.1 final release
On Mar 4, 2018 5:01 PM, "Bohdan Lyzanets" notifications@github.com wrote:
@tavelli https://github.com/tavelli you could revert 2.1.0-beta.2. CRA
has not build problem with this version—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/apollographql/react-apollo/issues/1734#issuecomment-370268192,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAdmVzZ6pxuQUv0KyXpMi1CUbyEtkOWuks5tbGQngaJpZM4SWEMD
.
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'

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! 🎉
This is being fixed in CRA in https://github.com/facebook/create-react-app/pull/4085
@jbaxleyiii seems to have fixed this in #1769. I expect there to be a new release containing the fix soon.
@excitement-engineer just tested with 2.1.0-rc.3, working great!
If your project is built with Create React App and not ejected, [email protected] 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!
@gaearon did not fixed, i had to downgrade to [email protected]
For others,
I tried the other solutions. But, only @fabien0102's solution worked for me.
version:
"react-apollo": "^2.1.0-beta.3",
I did "yarn install" and the error disappeared for me.
Most helpful comment
@excitement-engineer just tested with 2.1.0-rc.3, working great!