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

Cannot minify build with Create React APP #49

Closed
DrSkunk opened this issue Mar 2, 2018 · 4 comments
Closed

Cannot minify build with Create React APP #49

DrSkunk opened this issue Mar 2, 2018 · 4 comments

Comments

@DrSkunk
Copy link

DrSkunk commented Mar 2, 2018

When a blank Create React App is created and MidiConvert is a dependency, it is fine for developing. As soon as a build is started it gives the following error:

$ react-scripts build
Creating an optimized production build...
Failed to compile.

Failed to minify the code from this file:

 	./node_modules/midiconvert/src/Util.js:20

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

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

In the package.json from MidiConvert the following entry triggers the build of the source files.
"module": "src/MidiConvert.js",
When removed, the React project builds.

React project implementing MidiConvert.
Package JSON with erroring line of MidiConvert.

@appsforartists
Copy link
Collaborator

still precompile other ES6 features to ES5 if it intends to support older browsers

@gaearon curious about your thoughts here. ES2015 has been well supported across browsers for years, so I'm not terribly inclined to translate our builds to ES5. The operative word in your docs is if, but I'm not sure if there's an alternative when a package doesn't support ES5 (other than to fork, as you mention later in those docs).

@appsforartists
Copy link
Collaborator

I just looked at the module line, and it's pointing directly to our src folder, which makes me even less inclined to touch it.

@DrSkunk
Copy link
Author

DrSkunk commented Mar 3, 2018

Hello @appsforartists

Would you like me to open the issue over at the React repository?

@appsforartists
Copy link
Collaborator

If you want to, sure. It would be the create-react-app repo, and I don't know what they'd do. As I understand it, CRA is supposed to be a zero-config starter, which means there isn't a place to add exceptions.

But, requiring all dependencies to be ES5 seems heavyhanded, especially if you're importing from ES2015 modules. At the very least, I think they ought to fall back to main if module isn't ES5. (I'm still not convinced it makes any sense for them to require ES5 dependencies, but I don't know enough about that project to make a definitive statement.)

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

2 participants