Describe the bug
the problem is with the "const left = ...". After nuglifying, it gives error Uncaught SyntaxError: Unexpected token 'const'
If we change it to "let left = ..." then it works fine.
To Reproduce
var CS;
(function (CS) {
var Views;
(function (Views) {
class General {
test(a) {
const { IsTransitionDataset } = a;
if (IsTransitionDataset) {
return;
}
const left = (3 * 100).toFixed(2);
const e = $("
Minified output or stack trace
var CS;(function(n){var t;(function(n){class t{test(n){const{IsTransitionDataset:t}=n;if(!t)const i=300..toFixed(2),r=$("
With this code it is fine (changed "const left" to "let left")
var CS;
(function (CS) {
var Views;
(function (Views) {
class General {
test(a) {
const { IsTransitionDataset } = a;
if (IsTransitionDataset) {
return;
}
let left = (3 * 100).toFixed(2);
const e = $("
the problem appears to be when there are only const or let or var in a block.
Repro:
function test(a) {
const { IsTransitionDataset } = a;
if (IsTransitionDataset) {
return;
}
const left = 3;
const e = $("a").css('left', left + "px");
}
test('');
Result:
function test(n) {
const {IsTransitionDataset: t} = n;
if (!t)
const i=3,r=$("a").css("left",i+"px")
}
test("");
Result with "let left = 3":
function test(n) {
const {IsTransitionDataset: t} = n;
if (!t) {
let i = 3;
const r = $("a").css("left", i + "px")
}
}
test("");
This also repros:
function test(a) {
const { IsTransitionDataset } = a;
if (IsTransitionDataset) {
return;
}
let left = 3;
let e = $("a").css('left', left + "px");
}
test('');
Using latest version
Describe the bug the problem is with the "const left = ...". After nuglifying, it gives error Uncaught SyntaxError: Unexpected token 'const'
If we change it to "let left = ..." then it works fine.
To Reproduce var CS; (function (CS) { var Views; (function (Views) { class General { test(a) { const { IsTransitionDataset } = a; if (IsTransitionDataset) { return; } const left = (3 * 100).toFixed(2); const e = $("
${left}%
}).attr("data-datasetindex", 2); const $marker = $("Minified output or stack trace var CS;(function(n){var t;(function(n){class t{test(n){const{IsTransitionDataset:t}=n;if(!t)const i=300..toFixed(2),r=$("
${i}%
}).attr("data-datasetindex",2),u=$("Excepted output code var CS;(function(n){var t;(function(n){class t{test(n){const{IsTransitionDataset:t}=n;if(!t){const i=300..toFixed(2),r=$("
${i}%
}).attr("data-datasetindex",2),u=$("With this code it is fine (changed "const left" to "let left") var CS; (function (CS) { var Views; (function (Views) { class General { test(a) { const { IsTransitionDataset } = a; if (IsTransitionDataset) { return; } let left = (3 * 100).toFixed(2); const e = $("
${left}%
}).attr("data-datasetindex", 2); const $marker = $("generates this: var CS;(function(n){var t;(function(n){class t{test(n){const{IsTransitionDataset:t}=n;if(!t){let i=300..toFixed(2);const r=$("
${i}%
}).attr("data-datasetindex",2),u=$("Can you simplify that case case down please and format it nicely in github, cheers
redo :)
the problem appears to be when there are only const or let or var in a block.
Repro:
Result:
Result with "let left = 3":
This also repros:
One more case.
This code:
Produces this result (formatted):
And this also leads to the error "Unexpected token 'const'".