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

No longer works with uglify-js #610

Closed
ibc opened this issue Sep 12, 2018 · 7 comments
Closed

No longer works with uglify-js #610

ibc opened this issue Sep 12, 2018 · 7 comments

Comments

@ibc
Copy link
Contributor

ibc commented Sep 12, 2018

I think that, due this commit debug no longer works with browserify + gulp-uglify (which uses uglify-js internally):

 GulpUglifyError: unable to minify JavaScript
Caused by: SyntaxError: Unexpected token: keyword (const)
File: /Users/ibc/xxxx/src/myApp/myApp.js
Line: 24207
Col: 1

If I use browserify without uglify and check the generated bundled JS file, it contains:

const c = 'color: ' + this.color;

// and many other ES6 stuff

I don't think this is intentional, am I right?

@Qix-
Copy link
Member

Qix- commented Sep 12, 2018

It is intentional. Uglify is outdated doesn't work on ES6 code. Use gulp-uglify-es instead.

@Qix- Qix- closed this as completed Sep 12, 2018
@ibc
Copy link
Contributor Author

ibc commented Sep 12, 2018

gulp-uglify-es uses uglify-es which is buggy and unmaintained. You may mean gulp-terser and terser.

Anyway, are you aware that webpack requires that NPM dependencies are ES5? I mean: expect lot of complains due to this change in debug.

@Qix- Qix- mentioned this issue Sep 12, 2018
@Qix-
Copy link
Member

Qix- commented Sep 12, 2018

Check the package readme for gulp-uglify-es:

gulp stream to uglify with 'terser' (es6 supported).

terser is the new 'uglify-es'. uglify-es is no longer maintained.

It uses terser, pretty plainly indicated at the top of their readme.

@ibc
Copy link
Contributor Author

ibc commented Sep 12, 2018

Thanks, didn't check that.

Anyway, as said above, expect lot of complains from webpack users.

@Qix-
Copy link
Member

Qix- commented Sep 12, 2018

Also,

Anyway, are you aware that webpack requires that NPM dependencies are ES5?

Are you aware that babel exists and is a standard tool to compile ES6+ code to ES5 and pretty seamlessly interops with weboack, rollup, parcel and a slew of other bundlers that could have been easily researched with a Google search instead of yelling at a package maintainer? 😉

@ibc
Copy link
Contributor Author

ibc commented Sep 12, 2018

Sure, I know babel. I also know that default webpack configuration (that which is widely used) does not convert node_modules/* to ES5:

Just a reference: vercel/next.js#3564

@Qix-
Copy link
Member

Qix- commented Sep 12, 2018

@ibc I used to work at ZEIT. We used Babel very effectively where needed. You don't want your entire node_modules compiled because that would be silly.

Further, modules providing a transpiled version is unsustainable. Please read vercel/next.js#3564 (comment) as he is pretty objectively correct.

I won't discuss this issue any more as the decision has been made to follow current best practices. I suggest researching further as there are leagues of prose on this matter available to you through various searches. This is where the JavaScript ecosystem is headed and has already been adopted pretty much everywhere else.

Debug will not be transpiling code any longer except for browser versions, which I'm looking into deprecating as well.

@debug-js debug-js locked as off-topic and limited conversation to collaborators Sep 12, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants