Closed aimuzov closed 1 year ago
I think you need to set preset-env's targets
option to the older targets you support.
It's already setupped.
It's already setupped.
Hi, Have you solved it yet? I had the same problem, my targets were set low enough (chrome >= 40), but the jsx template product I built still contained const
// ...
function template(html, isCE, isSVG) {
var node;
var create = function create() {
var t = document.createElement("template");
t.innerHTML = html;
return isSVG ? t.content.firstChild.firstChild : t.content.firstChild;
};
var fn = isCE ? function () {
return untrack(function () {
return document.importNode(node || (node = create()), true);
});
} : function () {
return (node || (node = create())).cloneNode(true);
};
fn.cloneNode = fn;
return fn;
}
const _tmpl$ = /*#__PURE__*/template(`<div b=2 a>`);
// ^ this
Hi, I've encountered a problem. My code should be in es5 standard, but the bundle gets code with es6. I started looking into why this is happening and found a line of code that adds the 'const' declaration to the bundle.
If I change it here from const to var, the problem goes away:
(link to reference)
Example of code from bundle (before fix):
Example of code from bundle (after fix):
I think this is the wrong solution to the problem, but I haven't found any other way to downgrade the standard from es6 to es5. I started researching how other babel plugins are written and noticed that they specify var instead of const/let (for example: 1, 2, etc...).
How to solve this problem? I can create repo for reproduce problem if needed.
babel config:
P.S: Sorry for my bad English, it's not my native language.