Closed sebastian-ruiz closed 6 years ago
i hit the same error! when I run
npm run build
I get the error Failed to minify the code from this file:
./node_modules/meteor-client.js:5853
i found that because the meteor-client.js include e6, but create-react-app minify the code only in es5, so, i use uglifyjs-webpack-plugin which can use es6.
use web.browser.legacy is ok!
So you issue has been solved by settings arch to web.browser.legacy
in bundler configuration, right?
yes
Then, we can close the issue.
I am trying to use this with create-react-app similar to how it is done in ReactNativeMeteorBoilerplate.
I add
meteor-client.js
tonode_modules/
and then I can writeimport 'meteor-client';
and everything works as expected when runningnpm start
. However in create-react-app when I runnpm run build
I get the errorsee here: create-react-app README npm-run-build-fails-to-minify.
It seems that the code needs to be compiled to ES5. I try and do this using babel like so (package.json and running
npm run babel
):I put the new
meteor-client-es5.js
in thenode_modules/
directory and now doimport 'meteor-client-es5';
instead. Nownpm run build
compiles successfully. However when running in the browser it now gives the same browser console errors as runningnpm start
:Maybe babel is not compiling to ES5 properly? I don't know...
I created a repository showing what I have so far: https://github.com/vephinx/create-react-app-with-meteor