Uglifyjs: const => unexpected token

Created on 6 Apr 2020  Â·  2Comments  Â·  Source: mishoo/UglifyJS

I am developing web components.
uglify-js 3.6.0

dateRange.js

const template = document.createElement("template");
template.innerHTML = `
<style>
</style>
<div class='dateRange'>
</div>
`;

uglifyjs dateRange.js -c -m -o dateRange.min.js

Parse error at dateRange.js:1,1
const template = document.createElement("template");
^
ERROR: Unexpected token: keyword «const»
at JS_Parse_Error.get (eval at (C:UsersMichelAppDataRoamingnpmnode_modulesuglify-jstoolsnode.js:20:1), :71:23)
at fatal (C:UsersMichelAppDataRoamingnpmnode_modulesuglify-jsbinuglifyjs:298:27)
at run (C:UsersMichelAppDataRoamingnpmnode_modulesuglify-jsbinuglifyjs:241:9)
at Object. (C:UsersMichelAppDataRoamingnpmnode_modulesuglify-jsbinuglifyjs:167:5)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)

Most helpful comment

Ok, thanks!
Will switch to terser.

On Mon, Apr 6, 2020 at 2:01 PM Alex Lam S.L. notifications@github.com
wrote:

uglify-js supports JavaScript, not ES6 − please use var instead.

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/mishoo/UglifyJS2/issues/3764#issuecomment-609948374,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AFCG6G2LAXAA4V6RYZPZKMDRLIKIRANCNFSM4MCKKIDQ
.

All 2 comments

uglify-js supports JavaScript, not ES6 − please use var instead.

Ok, thanks!
Will switch to terser.

On Mon, Apr 6, 2020 at 2:01 PM Alex Lam S.L. notifications@github.com
wrote:

uglify-js supports JavaScript, not ES6 − please use var instead.

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/mishoo/UglifyJS2/issues/3764#issuecomment-609948374,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AFCG6G2LAXAA4V6RYZPZKMDRLIKIRANCNFSM4MCKKIDQ
.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gabmontes picture gabmontes  Â·  5Comments

uiteoi picture uiteoi  Â·  5Comments

lhtdesignde picture lhtdesignde  Â·  3Comments

JoeUX picture JoeUX  Â·  3Comments

diegocr picture diegocr  Â·  3Comments