Skip to content

Failed to minify on build #8

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

Closed
Mantis748 opened this issue Sep 4, 2018 · 6 comments
Closed

Failed to minify on build #8

Mantis748 opened this issue Sep 4, 2018 · 6 comments

Comments

@Mantis748
Copy link

Mantis748 commented Sep 4, 2018

Bootstrapped a project in Visual Studio Code using create-react-app, then installed @brightcove/react-player-loader. The dependency works fine during development, but when building (npm run build at the terminal), the following message is received:

Creating an optimized production build...
Failed to compile.

Failed to minify the code from this file:
./node_modules/@brightcove/react-player-loader/dist/brightcove-react-player-loader.es.js:251

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

I'm new at JS dev, but from what I gather in the link above, this was published as an ES6 file and needs to be built and published as a transpiled version.

@gkatsev
Copy link

gkatsev commented Sep 4, 2018

Thanks for the issue. Looks like we are transforming the files but there is some ES6 code left like const. We are using the browserlist project to determine which browsers to target and it's possible that they all support things like const. The minifier that is being used probably doesn't support const and thus the build fails. Looking at create-react-app, it looks like it's using webpack 3, which uses uglifyjs-webpack-plugin 0.4.6, which uses uglify 2, which doesn't support any ES6 features.
We'll investigate what we can do for this.

@misteroneill
Copy link
Contributor

misteroneill commented Sep 4, 2018

It seems like this issue is specific to this project - or specific to modules that are imported.

  • player-loader is transpiled in its various dist files. For example, here.
  • player-loader specifies that linked file in the module field, here.
  • However, when we import player-loader in this project, somehow we end up with its un-transpiled source code (search for const DEFAULTS).

I am still trying to figure out why this is the case.

@misteroneill
Copy link
Contributor

Found the issue. Versions of @brightcove/player-loader pre-1.3.1 (the latest) were not properly being transpiled. I will update the dependent version and release a patch of this project. I will also deprecate older releases to make this issue hopefully less impactful in the future.

@misteroneill
Copy link
Contributor

@Mantis748 Please try again with 1.0.2 of this library. Hope it resolves your issue. If not, please let us know.

@Mantis748
Copy link
Author

Works great - appreciate the extremely fast fix! @misteroneill

@misteroneill
Copy link
Contributor

No worries - thanks for reporting the issue @Mantis748 - it's really appreciated!

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