mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-06 21:10:38 +00:00
Merge branch 'dev' into feat/esm
This commit is contained in:
commit
5abf524b15
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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",
|
||||
|
4
test/fixtures/with-config/nuxt.config.js
vendored
4
test/fixtures/with-config/nuxt.config.js
vendored
@ -12,6 +12,10 @@ export default {
|
||||
name: 'about-bis',
|
||||
path: '/about-bis',
|
||||
component: '~/pages/about.vue'
|
||||
},
|
||||
{
|
||||
path: '/redirect/about-bis',
|
||||
redirect: '/about-bis'
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -171,6 +171,21 @@ test.serial('/test/about-bis (added with extendRoutes)', async t => {
|
||||
t.true(html.includes('<h1>About page</h1>'))
|
||||
})
|
||||
|
||||
test.serial('/test/redirect/about-bis (redirect with extendRoutes)', async t => {
|
||||
const logSpy = await interceptLog()
|
||||
const window = await nuxt.renderAndGetWindow(url('/test/redirect/about-bis'))
|
||||
t.true(logSpy.calledOnce)
|
||||
t.is(logSpy.args[0][0], 'Test plugin!')
|
||||
release()
|
||||
|
||||
const windowHref = window.location.href
|
||||
t.true(windowHref.includes('/test/about-bis'))
|
||||
|
||||
const html = window.document.body.innerHTML
|
||||
t.true(html.includes('<h1>Custom layout</h1>'))
|
||||
t.true(html.includes('<h1>About page</h1>'))
|
||||
})
|
||||
|
||||
test('Check stats.json generated by build.analyze', t => {
|
||||
const stats = require(resolve(
|
||||
__dirname,
|
||||
|
23
yarn.lock
23
yarn.lock
@ -122,6 +122,15 @@
|
||||
pretty-ms "^0.2.1"
|
||||
text-table "^0.2.0"
|
||||
|
||||
"@nuxtjs/friendly-errors-webpack-plugin@^2.0.0":
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/@nuxtjs/friendly-errors-webpack-plugin/-/friendly-errors-webpack-plugin-2.0.0.tgz#70fb321c78362e2b4bce1d522ecdf7f87a4dacec"
|
||||
dependencies:
|
||||
chalk "^2.3.2"
|
||||
error-stack-parser "^2.0.0"
|
||||
string-width "^2.0.0"
|
||||
strip-ansi "^4.0.0"
|
||||
|
||||
"@nuxtjs/youch@^4.2.3":
|
||||
version "4.2.3"
|
||||
resolved "https://registry.yarnpkg.com/@nuxtjs/youch/-/youch-4.2.3.tgz#36f8b22df5a0efaa81373109851e1d857aca6bed"
|
||||
@ -3218,14 +3227,6 @@ fresh@0.5.2, fresh@^0.5.2:
|
||||
version "0.5.2"
|
||||
resolved "https://registry.yarnpkg.com/fresh/-/fresh-0.5.2.tgz#3d8cadd90d976569fa835ab1f8e4b23a105605a7"
|
||||
|
||||
friendly-errors-webpack-plugin@^1.6.1:
|
||||
version "1.6.1"
|
||||
resolved "https://registry.yarnpkg.com/friendly-errors-webpack-plugin/-/friendly-errors-webpack-plugin-1.6.1.tgz#e32781c4722f546a06a9b5d7a7cfa28520375d70"
|
||||
dependencies:
|
||||
chalk "^1.1.3"
|
||||
error-stack-parser "^2.0.0"
|
||||
string-length "^1.0.1"
|
||||
|
||||
from2@^2.1.0:
|
||||
version "2.3.0"
|
||||
resolved "https://registry.yarnpkg.com/from2/-/from2-2.3.0.tgz#8bfb5502bde4a4d36cfdeea007fcca21d7e382af"
|
||||
@ -7051,12 +7052,6 @@ strict-uri-encode@^1.0.0:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz#279b225df1d582b1f54e65addd4352e18faa0713"
|
||||
|
||||
string-length@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/string-length/-/string-length-1.0.1.tgz#56970fb1c38558e9e70b728bf3de269ac45adfac"
|
||||
dependencies:
|
||||
strip-ansi "^3.0.0"
|
||||
|
||||
string-width@^1.0.1, string-width@^1.0.2:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3"
|
||||
|
Loading…
Reference in New Issue
Block a user