Static GitHub Issues

[259] Nuxt build is failing on uglify step

prev: Register component does not work.
next: How can I watch a folder routes (for express api)?

I am not able to run yarn build, because uglify is failing:

Parse error at .nuxt/dist/0.nuxt.bundle.js:4558,4
SyntaxError: Unexpected token: name (warn)

For some reason the following block of code in the 0.nuxt.bundle.js file is not properly converted to es5:

/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "warn", function() { return warn; });
// Copied from vue/src/core/util/debug.js

let warn = () => {}

if (false) {
  const hasConsole = typeof console !== 'undefined'

  warn = (msg, vm) => {
    if (hasConsole) {
      console.error(`[Vue warn]: ${msg} ` + (
        vm ? formatLocation(formatComponentName(vm)) : ''
      ))
    }
  }

  const formatComponentName = vm => {
    if (vm.$root === vm) {
      return 'root instance'
    }
    const name = vm._isVue
      ? vm.$options.name || vm.$options._componentTag
      : vm.name
    return name ? `component <${name}>` : `anonymous component`
  }

  const formatLocation = str => {
    if (str === 'anonymous component') {
      str += ` - use the "name" option for better debugging messages.`
    }
    return `(found in ${str})`
  }
}




/***/ }),

and therefore uglify fails when it is processing this arrow function: let warn = () => {}. The rest of the file looks fine. Maybe it is bug in vue-loader, not quite sure

<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c222">#c222</a>)</em></sub></div>