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

uglifyjs output no longer ES5, introduces arrow functions #5967

Open
mirabilos opened this issue Jan 10, 2025 · 0 comments
Open

uglifyjs output no longer ES5, introduces arrow functions #5967

mirabilos opened this issue Jan 10, 2025 · 0 comments

Comments

@mirabilos
Copy link

Uglify version (uglifyjs -V)

3.19.3

JavaScript input

Dygraphs 2.2.1

The uglifyjs CLI command executed or minify() options used.

uglifyjs --compress --mangle --output-opts 'preamble='\''/*! @license https://github.com/danvk/dygraphs/blob/v2.2.1/LICENSE.txt (MIT) */'\' --source-map 'content='\''dygraph.min.tmp.js.map'\'',includeSources=true,url='\''dygraph.min.js.map'\' -o dygraph.min.js dygraph.min.tmp.js

JavaScript output or error produced.

2025-01-10T20:46:43.6114772Z > ./scripts/run-tests.sh min
2025-01-10T20:46:43.6114926Z 
2025-01-10T20:46:44.8011713Z (node:4096) [DEP0066] DeprecationWarning: OutgoingMessage.prototype._headers is deprecated
2025-01-10T20:46:44.8012354Z (Use `node --trace-deprecation ...` to show where the warning was created)
2025-01-10T20:46:44.8496307Z SyntaxError: Parse error

This is because the tests run in PhantomJS, which is ES5 only (and the output is supposed to be usable in ES5-only browsers as well).

The actual problem is (diffing between a working output from an older uglifyjs version and the newer one):

[…] "dygraphs/src/dygraph-canvas.js":[function(t,e,a){[-"use strict";-]Object.defineProperty(a,"__esModule",{value:!0}),a.default=void 0;var T=[-function-]{+(+}(t,e){+=>+}{if(!e&&t&&t.__esModule)return t; […]

So it’s removing the “use strict” and changing a function to an arrow function. This is a hard bug, a regression and a showstopper.

mirabilos added a commit to danvk/dygraphs that referenced this issue Jan 10, 2025
• --v8 and --webkit for improved browser support,
  we will skip on --ie though I think
• --no-module which is undocumented but may work around
  mishoo/UglifyJS#5967
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

1 participant