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

How to get more info about a failing build #3381

Closed
tnrich opened this issue Oct 31, 2017 · 6 comments
Closed

How to get more info about a failing build #3381

tnrich opened this issue Oct 31, 2017 · 6 comments

Comments

@tnrich
Copy link

tnrich commented Oct 31, 2017

Hey there,

My CRA yarn build fails but doesn't give me much info:

yarn build v1.0.1
warning ../package.json: No license field
warning ../../package.json: No license field
$ react-scripts build
Creating an optimized production build...
Failed to compile.

Failed to minify the code from this file:

        ./node_modules/open-vector-editor/node_modules/ve-sequence-utils/tidyUpSequenceData.js:14

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

I was just wondering if there were some sort of flag I could add to see additional info about what the exact reason for failure is.

Thanks!

@viankakrisna
Copy link
Contributor

From the contents of the link in the error message:

Some third-party packages don't compile their code to ES5 before publishing to npm. This often causes problems in the ecosystem because neither browsers (except for most modern versions) nor some tools currently support all ES6 features. We recommend to publish code on npm as ES5 at least for a few more years.

To resolve this:
Open an issue on the dependency's issue tracker and ask that the package be published pre-compiled.
Note: Create React App can consume both CommonJS and ES modules. For Node.js compatibility, it is recommended that the main entry point is CommonJS. However, they can optionally provide an ES module entry point with the module field in package.json. Note that even if a library provides an ES Modules version, it should still precompile other ES6 features to ES5 if it intends to support older browsers.
Fork the package and publish a corrected version yourself.

If the dependency is small enough, copy it to your src/ folder and treat it as application code.

In the future, we might start automatically compiling incompatible third-party modules, but it is not currently supported. This approach would also slow down the production builds.

I think we can improve the error message by outputting a preview of the file and provide a full path so it can be copy-pasted.

@tnrich
Copy link
Author

tnrich commented Oct 31, 2017

Hey @viankakrisna I checked out the link as well. I am the third party library author in this case but am confused about what the actual issue is. It appears to be caused by trying to get assign like so:

const assign = require("lodash/assign")

But I don't get why that is not considered proper es5 syntax. So maybe more info about the underlying error message would be helpful because I could google why uglifyjs is failing for this case.

Thanks!

@viankakrisna
Copy link
Contributor

const is an es6 specific feature.

I agree that it's useful to show the full error before showing the formatted message. The code responsible for that is here https://github.com/facebookincubator/create-react-app/blob/master/packages/react-dev-utils/printBuildError.js#L17-L43

@tnrich
Copy link
Author

tnrich commented Oct 31, 2017

@viankakrisna you are right, const is es6 but is it the use of const that is failing?

@gaearon
Copy link
Contributor

gaearon commented Oct 31, 2017

Yes.

@gaearon gaearon closed this as completed Oct 31, 2017
@tnrich
Copy link
Author

tnrich commented Oct 31, 2017

@gaearon is there a way we could implement what @viankakrisna suggested above

I agree that it's useful to show the full error before showing the formatted message.

I think that would be very useful if it provided more info. Until that is resolved I don't think this should be closed.

It would also help if #2108 were implemented.

@lock lock bot locked and limited conversation to collaborators Jan 21, 2019
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

3 participants