Skip to content

uglifyjs output no longer ES5, introduces arrow functions #5967

Open
@mirabilos

Description

@mirabilos

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions