UglifyJS icon indicating copy to clipboard operation
UglifyJS copied to clipboard

const => unexpected token

Open mpoirier101 opened this issue 6 years ago • 2 comments

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:\Users\Michel\AppData\Roaming\npm\node_modules\uglify-js\tools\node.js:20:1), :71:23) at fatal (C:\Users\Michel\AppData\Roaming\npm\node_modules\uglify-js\bin\uglifyjs:298:27) at run (C:\Users\Michel\AppData\Roaming\npm\node_modules\uglify-js\bin\uglifyjs:241:9) at Object. (C:\Users\Michel\AppData\Roaming\npm\node_modules\uglify-js\bin\uglifyjs: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)

mpoirier101 avatar Apr 06 '20 14:04 mpoirier101

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

alexlamsl avatar Apr 06 '20 18:04 alexlamsl

Ok, thanks! Will switch to terser.

On Mon, Apr 6, 2020 at 2:01 PM Alex Lam S.L. [email protected] 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 .

mpoirier101 avatar Apr 06 '20 18:04 mpoirier101