Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CRA Failed to minify the code from this file: mobx.module.js:23 #1584

Closed
ashconnell opened this issue Jun 9, 2018 · 5 comments
Closed

CRA Failed to minify the code from this file: mobx.module.js:23 #1584

ashconnell opened this issue Jun 9, 2018 · 5 comments

Comments

@ashconnell
Copy link

This related issue was fixed but it looks like it might be back in 5.0.0

ashconnell$ yarn build
yarn run v1.7.0
$ react-scripts build
Creating an optimized production build...
Failed to compile.

Failed to minify the code from this file:

        ./node_modules/mobx/lib/mobx.module.js:23

Read more here: http://bit.ly/2tRViJ9

error Command failed with exit code 1.

Quickest way to reproduce is to git clone this repo and run yarn && yarn build

@mweststrate
Copy link
Member

I have some idea what is happening here and will investigate further on monday, but first a double check, you are using the latest version of CRA?

@feat7
Copy link

feat7 commented Jun 9, 2018

I got into same issue today. After a lot of research and different attempts to solve the error, everything went in vain.
I am using custom-react-scripts with create-react-app
I managed to solve this issue by downgrading to mobx@4.3.1 (any version of 4 is working fine)
Hope this temporarily fix the issue.

@ashconnell
Copy link
Author

ashconnell commented Jun 9, 2018

@mweststrate i used npx create-react-app ... which i believe always uses the latest version of a package,

You can get a minimal reproduction with this:

npx create-react-app mobx-5-cra-build
cd mobx-5-cra-build
yarn add mobx
echo "import { observable } from 'mobx'" > src/index.js
yarn build

I've spent an hour looking into this but i'm not super familiar with rollup and how CRA builds work

@mweststrate
Copy link
Member

Thanks for the minimal reproduction @ashconnell.

I reverted MobX back to using ES5 only. That should solve thte issue. Released as 5.0.1

@mweststrate
Copy link
Member

Pro tip, the default build is now ES5, but you can still use the smaller and faster build by setting up an alias. Webpack example: resolve: { alias: { mobx: __dirname + "/node_modules/mobx/lib/mobx.es6.js" }}

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

No branches or pull requests

3 participants