mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-27 08:02:01 +00:00
Format code
This commit is contained in:
parent
71c9838008
commit
fd833216df
@ -32,9 +32,7 @@ const defaultTransition = <%=
|
|||||||
.replace('afterLeave(', 'function(').replace('leaveCancelled(', 'function(')
|
.replace('afterLeave(', 'function(').replace('leaveCancelled(', 'function(')
|
||||||
%>
|
%>
|
||||||
|
|
||||||
export { NuxtError }
|
function createApp (ssrContext) {
|
||||||
|
|
||||||
export function createApp (ssrContext) {
|
|
||||||
<% if (store) { %>
|
<% if (store) { %>
|
||||||
const store = createStore()
|
const store = createStore()
|
||||||
<% } %>
|
<% } %>
|
||||||
@ -119,3 +117,5 @@ export function createApp (ssrContext) {
|
|||||||
|
|
||||||
return { app, router<%= (store ? ', store' : '') %> }
|
return { app, router<%= (store ? ', store' : '') %> }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export { createApp, NuxtError }
|
||||||
|
@ -101,18 +101,17 @@ export default function () {
|
|||||||
try {
|
try {
|
||||||
var { html, error } = yield self.renderRoute(route, { _generate: true })
|
var { html, error } = yield self.renderRoute(route, { _generate: true })
|
||||||
if(error) {
|
if(error) {
|
||||||
errors.push({type : "handled", route, error})
|
errors.push({ type : 'handled', route, error })
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
errors.push({type : "unhandled", route, error : err})
|
errors.push({ type : 'unhandled', route, error: err })
|
||||||
return
|
return
|
||||||
|
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
var minifiedHtml = minify(html, self.options.generate.minify)
|
var minifiedHtml = minify(html, self.options.generate.minify)
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
let minifyErr = new Error(`HTML minification failed. Make sure the route generates valid HTML. Failed HTML:\n ${html}`)
|
let minifyErr = new Error(`HTML minification failed. Make sure the route generates valid HTML. Failed HTML:\n ${html}`)
|
||||||
errors.push({type : "unhandled", route, error : minifyErr})
|
errors.push({ type : 'unhandled', route, error: minifyErr })
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
var path = join(route, sep, 'index.html') // /about -> /about/index.html
|
var path = join(route, sep, 'index.html') // /about -> /about/index.html
|
||||||
@ -137,14 +136,13 @@ export default function () {
|
|||||||
debug(`HTML Files generated in ${duration}s`)
|
debug(`HTML Files generated in ${duration}s`)
|
||||||
|
|
||||||
if (errors.length) {
|
if (errors.length) {
|
||||||
console.error("==== Error report ==== \n" + errors.map( ({type, route, error}) => {
|
console.error('==== Error report ==== \n' + errors.map( ({type, route, error}) => {
|
||||||
if(type == "unhandled") {
|
if(type === 'unhandled') {
|
||||||
return `Route: '${route}'\n${error.stack}`
|
return `Route: '${route}'\n${error.stack}`
|
||||||
} else {
|
} else {
|
||||||
return `Route: '${route}' returned an error via context.error: \n` +
|
return `Route: '${route}' thrown an error: \n` + JSON.stringify(error)
|
||||||
JSON.stringify(error)
|
|
||||||
}
|
}
|
||||||
}).join("\n\n"))
|
}).join('\n\n'))
|
||||||
}
|
}
|
||||||
return this
|
return this
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user