diff --git a/lib/app/router.js b/lib/app/router.js index 2238ee8ef3..b49a436aa9 100644 --- a/lib/app/router.js +++ b/lib/app/router.js @@ -7,8 +7,9 @@ import Router from 'vue-router' route._name = '_' + hash(route.component) components.push({ _name: route._name, component: route.component, name: route.name, chunkName: route.chunkName }) res += tab + '{\n' - res += tab + '\tpath: ' + JSON.stringify(route.path) + ',\n' - res += tab + '\tcomponent: ' + (splitPages ? route._name : `() => ${route._name}.default || ${route._name}`) + res += tab + '\tpath: ' + JSON.stringify(route.path) + res += (route.component) ? ',\n\t' + tab + 'component: ' + (splitPages ? route._name : `() => ${route._name}.default || ${route._name}`) : '' + res += (route.redirect) ? ',\n\t' + tab + 'redirect: ' + JSON.stringify(route.redirect) : '' res += (route.name) ? ',\n\t' + tab + 'name: ' + JSON.stringify(route.name) : '' res += (route.children) ? ',\n\t' + tab + 'children: [\n' + recursiveRoutes(routes[i].children, tab + '\t\t', components) + '\n\t' + tab + ']' : '' res += '\n' + tab + '}' + (i + 1 === routes.length ? '' : ',\n') @@ -18,6 +19,7 @@ import Router from 'vue-router' const _components = [] const _routes = recursiveRoutes(router.routes, '\t\t', _components) %><%= uniqBy(_components, '_name').map((route) => { + if (!route.component) return '' const path = relativeToBuild(route.component) const chunkName = wChunk(route.chunkName) const name = route._name diff --git a/lib/builder/webpack/client.config.js b/lib/builder/webpack/client.config.js index 4163a21e15..5c1e70922c 100644 --- a/lib/builder/webpack/client.config.js +++ b/lib/builder/webpack/client.config.js @@ -3,13 +3,14 @@ import webpack from 'webpack' // import VueSSRClientPlugin from 'vue-server-renderer/client-plugin' import VueSSRClientPlugin from './plugins/vue/client' import HTMLPlugin from 'html-webpack-plugin' -import FriendlyErrorsWebpackPlugin from 'friendly-errors-webpack-plugin' +import FriendlyErrorsWebpackPlugin from '@nuxtjs/friendly-errors-webpack-plugin' import StylishPlugin from 'webpack-stylish' import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer' import { resolve } from 'path' import Debug from 'debug' import base from './base.config.js' + const debug = Debug('nuxt:build') debug.color = 2 // Force green color diff --git a/package.json b/package.json index d400b3b149..e8d47669d2 100644 --- a/package.json +++ b/package.json @@ -58,6 +58,7 @@ "npm": ">=5.0.0" }, "dependencies": { + "@nuxtjs/friendly-errors-webpack-plugin": "^2.0.0", "@nuxtjs/youch": "^4.2.3", "ansi-html": "^0.0.7", "autoprefixer": "^8.1.0", @@ -77,7 +78,6 @@ "extract-text-webpack-plugin": "^4.0.0-beta.0", "file-loader": "^1.1.11", "fresh": "^0.5.2", - "friendly-errors-webpack-plugin": "^1.6.1", "fs-extra": "^5.0.0", "glob": "^7.1.2", "hash-sum": "^1.0.2", diff --git a/test/fixtures/with-config/nuxt.config.js b/test/fixtures/with-config/nuxt.config.js index 80f0920abb..a8c6314350 100644 --- a/test/fixtures/with-config/nuxt.config.js +++ b/test/fixtures/with-config/nuxt.config.js @@ -12,6 +12,10 @@ export default { name: 'about-bis', path: '/about-bis', component: '~/pages/about.vue' + }, + { + path: '/redirect/about-bis', + redirect: '/about-bis' } ] } diff --git a/test/with-config.test.js b/test/with-config.test.js index e1bbcb3ef0..4ace3bd8d2 100644 --- a/test/with-config.test.js +++ b/test/with-config.test.js @@ -171,6 +171,21 @@ test.serial('/test/about-bis (added with extendRoutes)', async t => { t.true(html.includes('