Closed trompx closed 7 years ago
Hello @1egoman,
Commands I run triggering the issue:
debundle -i public/assets/frontend/js/modules/scripts.js -o public/assets/frontend/js/modules/unpacked/ -c public/assets/frontend/js/modules/debundle.config.json
or just
debundle
Content of debundle.config.json:
{ "type": "browserify", "knownPaths": {} }
Error I get:
/usr/local/lib/node_modules/debundle/src/index.js:58 let ast = acorn.parse(bundleContents, {}); ^^^ SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
The bundle I try to debundle:
!function t(e, i, r) { function n(s, a) { if (!i[s]) { if (!e[s]) { var l = "function" == typeof require && require; if (!a && l) return l(s, !0); if (o) return o(s, !0); var u = new Error("Cannot find module '" + s + "'"); throw u.code = "MODULE_NOT_FOUND", u } var h = i[s] = { exports: {} }; e[s][0].call(h.exports, function(t) { var i = e[s][1][t]; return n(i ? i : t) }, h, h.exports, t, e, i, r) } return i[s].exports } for (var o = "function" == typeof require && require, s = 0; s < r.length; s++) n(r[s]); return n } ({ 1: [function(t, e, i) { "use strict"; function r(t, e) { Array.isArray(t) ? t.forEach(function(t) { r(t, e) }) : (t.jquery || 1 === t.nodeType || "string" == typeof t) && TweenMax.set(t, { clearProps: e }) } i.__esModule = !0, i.default = function(t) { t.getChildren().forEach(function(t) { var e = !t.vars.data || void 0 === t.vars.data.clear || t.vars.data.clear === !0; if (t.target && t.vars && t.vars.css && e) { var i; for (var n in t.vars.css) i ? i += "," : i = "", "autoAlpha" === n && (n = "opacity,visibility"), i += n; i && r(t.target, i) } }) } } , {}], 2: [function(t, e, i) { "use strict"; function r(t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") } i.__esModule = !0; var n = function() { function t() { r(this, t) } return t.prototype.init = function() { this.element = $("#lang") }, t.prototype.one = function(t) { // } , t.prototype.two = function() { // }, t }(); i.default = new n } , {}] }, {}, [1]);
Is it supposed to debundle babelified code too? I would like the debundled file to have the nice ES6 classes.
Let me know if I can provide more info, and thanks for open sourcing debundle!
@trompx What version of node are you using? Can you try a node version >= v6?
In fact upgrading from 5.9.1 to 6.5.0 solved this issue, thanks!
Hello @1egoman,
Commands I run triggering the issue:
or just
Content of debundle.config.json:
Error I get:
The bundle I try to debundle:
Is it supposed to debundle babelified code too? I would like the debundled file to have the nice ES6 classes.
Let me know if I can provide more info, and thanks for open sourcing debundle!