nuxt
nuxt copied to clipboard
Nuxt generates ES5 code even when chrome 100 / modern mode is enabled
Sorry for the lack of reproduction build but this can be inspected only after building:
// nuxt.config.js
presets({ envName }) {
const envTargets = {
client: { browsers: ['last 2 versions', 'not IE < 12', 'not op_mob < 100', 'not op_mini all'] },
server: { node: 'current' },
}
return [
[
'@nuxt/babel-preset-app',
{
targets: envTargets[envName],
},
],
]
},
part of the generated JS of the main bundle:
// app-4f179f8.modern.js
/*! For license information please see ../LICENSES */
(window.webpackJsonp = window.webpackJsonp || []).push([[48], [, , function(t, e, n) {
"use strict";
n.r(e),
function(t, n) {
var r = Object.freeze({});
function o(t) {
return null == t
}
function c(t) {
return null != t
}
function f(t) {
return !0 === t
}
function l(t) {
return "string" == typeof t || "number" == typeof t || "symbol" == typeof t || "boolean" == typeof t
}
function h(t) {
return null !== t && "object" == typeof t
}
var d = Object.prototype.toString;
function v(t) {
return "[object Object]" === d.call(t)
}
function y(t) {
return "[object RegExp]" === d.call(t)
}
function m(t) {
var e = parseFloat(String(t));
return e >= 0 && Math.floor(e) === e && isFinite(t)
}
function w(t) {
return c(t) && "function" == typeof t.then && "function" == typeof t.catch
}
function x(t) {
return null == t ? "" : Array.isArray(t) || v(t) && t.toString === d ? JSON.stringify(t, null, 2) : String(t)
}
function _(t) {
var e = parseFloat(t);
return isNaN(e) ? t : e
}
function A(t, e) {
for (var map = Object.create(null), n = t.split(","), i = 0; i < n.length; i++)
map[n[i]] = !0;
return e ? function(t) {
return map[t.toLowerCase()]
}
: function(t) {
return map[t]
}
}
A("slot,component", !0);
var O = A("key,ref,slot,slot-scope,is");
function S(t, e) {
if (t.length) {
var n = t.indexOf(e);
if (n > -1)
return t.splice(n, 1)
}
}
var E = Object.prototype.hasOwnProperty;
function k(t, e) {
return E.call(t, e)
}
function T(t) {
var e = Object.create(null);
return function(n) {
return e[n] || (e[n] = t(n))
}
}
var C = /-(\w)/g
, j = T((function(t) {
return t.replace(C, (function(t, e) {
return e ? e.toUpperCase() : ""
}
))
}
))
, $ = T((function(t) {
return t.charAt(0).toUpperCase() + t.slice(1)
}
))
, R = /\B([A-Z])/g
, P = T((function(t) {
return t.replace(R, "-$1").toLowerCase()
}
));
var I = Function.prototype.bind ? function(t, e) {
return t.bind(e)
}
: function(t, e) {
function n(a) {
var n = arguments.length;
return n ? n > 1 ? t.apply(e, arguments) : t.call(e, a) : t.call(e)
}
return n._length = t.length,
n
}
;
function M(t, e) {
e = e || 0;
for (var i = t.length - e, n = new Array(i); i--; )
n[i] = t[i + e];
return n
}
function L(t, e) {
for (var n in e)
t[n] = e[n];
return t
}
function N(t) {
for (var e = {}, i = 0; i < t.length; i++)
t[i] && L(e, t[i]);
return e
}
function U(a, b, t) {}
var D = function(a, b, t) {
return !1
}
, F = function(t) {
return t
};
function B(a, b) {
if (a === b)
return !0;
var t = h(a)
, e = h(b);
if (!t || !e)
return !t && !e && String(a) === String(b);
try {
var n = Array.isArray(a)
, r = Array.isArray(b);
if (n && r)
return a.length === b.length && a.every((function(t, i) {
return B(t, b[i])
}
));
if (a instanceof Date && b instanceof Date)
return a.getTime() === b.getTime();
if (n || r)
return !1;
var o = Object.keys(a)
, c = Object.keys(b);
return o.length === c.length && o.every((function(t) {
return B(a[t], b[t])
}
))
} catch (t) {
return !1
}
}
function H(t, e) {
for (var i = 0; i < t.length; i++)
if (B(t[i], e))
return i;
return -1
}
function z(t) {
var e = !1;
return function() {
e || (e = !0,
t.apply(this, arguments))
}
}
var V = "data-server-rendered"
, W = ["component", "directive", "filter"]
, G = ["beforeCreate", "created", "beforeMount", "mounted", "beforeUpdate", "updated", "beforeDestroy", "destroyed", "activated", "deactivated", "errorCaptured", "serverPrefetch"]
, K = {
optionMergeStrategies: Object.create(null),
silent: !1,
productionTip: !1,
devtools: !1,
performance: !1,
errorHandler: null,
warnHandler: null,
ignoredElements: [],
keyCodes: Object.create(null),
isReservedTag: D,
isReservedAttr: D,
isUnknownElement: D,
getTagNamespace: U,
parsePlatformTagName: F,
mustUseProp: D,
async: !0,
_lifecycleHooks: G
}
, Y = /a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD/;
function J(t) {
var e = (t + "").charCodeAt(0);
return 36 === e || 95 === e
}
function X(t, e, n, r) {
Object.defineProperty(t, e, {
value: n,
enumerable: !!r,
writable: !0,
configurable: !0
})
}
var Q = new RegExp("[^" + Y.source + ".$_\\d]");
var Z, tt = "__proto__"in {}, et = "undefined" != typeof window, nt = "undefined" != typeof WXEnvironment && !!WXEnvironment.platform, ot = nt && WXEnvironment.platform.toLowerCase(), it = et && window.navigator.userAgent.toLowerCase(), at = it && /msie|trident/.test(it), st = it && it.indexOf("msie 9.0") > 0, ut = it && it.indexOf("edge/") > 0, ct = (it && it.indexOf("android"),
it && /iphone|ipad|ipod|ios/.test(it) || "ios" === ot), ft = (it && /chrome\/\d+/.test(it),
it && /phantomjs/.test(it),
it && it.match(/firefox\/(\d+)/)), lt = {}.watch, pt = !1;
if (et)
try {
var ht = {};
Object.defineProperty(ht, "passive", {
get: function() {
pt = !0
}
}),
window.addEventListener("test-passive", null, ht)
} catch (t) {}
var vt = function() {
return void 0 === Z && (Z = !et && !nt && void 0 !== t && (t.process && "server" === t.process.env.VUE_ENV)),
Z
}
, yt = et && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
function mt(t) {
return "function" == typeof t && /native code/.test(t.toString())
}
var gt, bt = "undefined" != typeof Symbol && mt(Symbol) && "undefined" != typeof Reflect && mt(Reflect.ownKeys);
gt = "undefined" != typeof Set && mt(Set) ? Set : function() {
function t() {
this.set = Object.create(null)
}
return t.prototype.has = function(t) {
return !0 === this.set[t]
}
,
t.prototype.add = function(t) {
this.set[t] = !0
}
,
t.prototype.clear = function() {
this.set = Object.create(null)
}
,
t
}();
var wt = U
, xt = 0
, _t = function() {
this.id = xt++,
this.subs = []
};
_t.prototype.addSub = function(sub) {
this.subs.push(sub)
}
,
_t.prototype.removeSub = function(sub) {
S(this.subs, sub)
}
,
_t.prototype.depend = function() {
_t.target && _t.target.addDep(this)
}
,
_t.prototype.notify = function() {
var t = this.subs.slice();
for (var i = 0, e = t.length; i < e; i++)
t[i].update()
}
,
_t.target = null;
var At = [];
function Ot(t) {
At.push(t),
_t.target = t
}
function St() {
At.pop(),
_t.target = At[At.length - 1]
}
var Et = function(t, data, e, text, n, r, o, c) {
this.tag = t,
this.data = data,
this.children = e,
this.text = text,
this.elm = n,
this.ns = void 0,
this.context = r,
this.fnContext = void 0,
this.fnOptions = void 0,
this.fnScopeId = void 0,
this.key = data && data.key,
this.componentOptions = o,
this.componentInstance = void 0,
this.parent = void 0,
this.raw = !1,
this.isStatic = !1,
this.isRootInsert = !0,
this.isComment = !1,
this.isCloned = !1,
this.isOnce = !1,
this.asyncFactory = c,
this.asyncMeta = void 0,
this.isAsyncPlaceholder = !1
}
, kt = {
child: {
configurable: !0
}
};
kt.child.get = function() {
return this.componentInstance
}
,
Object.defineProperties(Et.prototype, kt);
var Tt = function(text) {
void 0 === text && (text = "");
var t = new Et;
return t.text = text,
t.isComment = !0,
t
};
function Ct(t) {
return new Et(void 0,void 0,void 0,String(t))
}
function jt(t) {
var e = new Et(t.tag,t.data,t.children && t.children.slice(),t.text,t.elm,t.context,t.componentOptions,t.asyncFactory);
return e.ns = t.ns,
e.isStatic = t.isStatic,
e.key = t.key,
e.isComment = t.isComment,
e.fnContext = t.fnContext,
e.fnOptions = t.fnOptions,
e.fnScopeId = t.fnScopeId,
e.asyncMeta = t.asyncMeta,
e.isCloned = !0,
e
}
var $t = Array.prototype
, Rt = Object.create($t);
["push", "pop", "shift", "unshift", "splice", "sort", "reverse"].forEach((function(t) {
var e = $t[t];
X(Rt, t, (function() {
for (var n = [], r = arguments.length; r--; )
n[r] = arguments[r];
var o, c = e.apply(this, n), f = this.__ob__;
switch (t) {
case "push":
case "unshift":
o = n;
break;
case "splice":
o = n.slice(2)
}
return o && f.observeArray(o),
f.dep.notify(),
c
}
))
}
));
var Pt = Object.getOwnPropertyNames(Rt)
, It = !0;
function Mt(t) {
It = t
}
var Lt = function(t) {
this.value = t,
this.dep = new _t,
this.vmCount = 0,
X(t, "__ob__", this),
Array.isArray(t) ? (tt ? function(t, e) {
t.__proto__ = e
}(t, Rt) : function(t, e, n) {
for (var i = 0, r = n.length; i < r; i++) {
var o = n[i];
X(t, o, e[o])
}
}(t, Rt, Pt),
this.observeArray(t)) : this.walk(t)
};
function Nt(t, e) {
var n;
if (h(t) && !(t instanceof Et))
return k(t, "__ob__") && t.__ob__ instanceof Lt ? n = t.__ob__ : It && !vt() && (Array.isArray(t) || v(t)) && Object.isExtensible(t) && !t._isVue && (n = new Lt(t)),
e && n && n.vmCount++,
n
}
function Ut(t, e, n, r, o) {
var c = new _t
, f = Object.getOwnPropertyDescriptor(t, e);
if (!f || !1 !== f.configurable) {
var l = f && f.get
, h = f && f.set;
l && !h || 2 !== arguments.length || (n = t[e]);
var d = !o && Nt(n);
Object.defineProperty(t, e, {
enumerable: !0,
configurable: !0,
get: function() {
var e = l ? l.call(t) : n;
return _t.target && (c.depend(),
d && (d.dep.depend(),
Array.isArray(e) && Ft(e))),
e
},
set: function(e) {
var r = l ? l.call(t) : n;
e === r || e != e && r != r || l && !h || (h ? h.call(t, e) : n = e,
d = !o && Nt(e),
c.notify())
}
})
}
}
function Dt(t, e, n) {
if (Array.isArray(t) && m(e))
return t.length = Math.max(t.length, e),
t.splice(e, 1, n),
n;
if (e in t && !(e in Object.prototype))
return t[e] = n,
n;
var r = t.__ob__;
return t._isVue || r && r.vmCount ? n : r ? (Ut(r.value, e, n),
r.dep.notify(),
n) : (t[e] = n,
n)
}
// a lot more stuff
]]);
@pi0 would appreciate a quick feedback to see if its my config wrong, or if what I'm seeing is what I'm supposed to be seeing (?) (would be weird)
Do you have a browserslist file in your project?
Do you have a browserslist file in your project?
I am using the package.json config option:
{
"browserslist": "chrome 99",
}