mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 22:25:12 +00:00
Merge branch 'tapable' of github.com:nuxt/nuxt.js into tapable
This commit is contained in:
commit
8aaadfae79
@ -131,6 +131,7 @@ const defaultOptions = {
|
||||
},
|
||||
render: {
|
||||
ssr: {},
|
||||
resourceHints: true,
|
||||
http2: {
|
||||
push: false
|
||||
},
|
||||
|
@ -328,8 +328,14 @@ export default class Renderer extends Tapable {
|
||||
if (this.options._routerBaseSpecified) {
|
||||
HEAD += `<base href="${this.options.router.base}">`
|
||||
}
|
||||
const resourceHints = context.renderResourceHints()
|
||||
HEAD += resourceHints + context.renderStyles()
|
||||
|
||||
let resourceHints = ''
|
||||
if (this.options.render.resourceHints) {
|
||||
resourceHints = context.renderResourceHints()
|
||||
HEAD += resourceHints
|
||||
}
|
||||
|
||||
HEAD += context.renderStyles()
|
||||
APP += `<script type="text/javascript">window.__NUXT__=${serialize(context.nuxt, { isJSON: true })}</script>`
|
||||
APP += context.renderScripts()
|
||||
|
||||
|
@ -7,7 +7,6 @@ const port = 4001
|
||||
const url = (route) => 'http://localhost:' + port + route
|
||||
|
||||
let nuxt = null
|
||||
let server = null
|
||||
|
||||
// Init nuxt.js and create server listening on localhost:4000
|
||||
test.before('Init Nuxt.js', async t => {
|
||||
@ -38,6 +37,5 @@ test('/_nuxt/test.hot-update.json should returns empty html', async t => {
|
||||
|
||||
// Close server and ask nuxt to stop listening to file changes
|
||||
test.after('Closing server and nuxt.js', async t => {
|
||||
server.close()
|
||||
await nuxt.close(() => {})
|
||||
await nuxt.close()
|
||||
})
|
||||
|
@ -30,7 +30,7 @@ test.before('Init Nuxt.js', async t => {
|
||||
server = http.createServer((req, res) => {
|
||||
serve(req, res, finalhandler(req, res))
|
||||
})
|
||||
await nuxt.listen(port)
|
||||
server.listen(port)
|
||||
})
|
||||
|
||||
test('/stateless', async t => {
|
||||
|
@ -8,7 +8,6 @@ const port = 4003
|
||||
const url = (route) => 'http://localhost:' + port + route
|
||||
|
||||
let nuxt = null
|
||||
let server = null
|
||||
|
||||
// Init nuxt.js and create server listening on localhost:4000
|
||||
test.before('Init Nuxt.js', async t => {
|
||||
@ -156,6 +155,5 @@ test('ETag Header', async t => {
|
||||
|
||||
// Close server and ask nuxt to stop listening to file changes
|
||||
test.after('Closing server and nuxt.js', t => {
|
||||
server.close()
|
||||
nuxt.close()
|
||||
})
|
||||
|
@ -6,7 +6,6 @@ const port = 4004
|
||||
// const url = (route) => 'http://localhost:' + port + route
|
||||
|
||||
let nuxt = null
|
||||
let server = null
|
||||
|
||||
// Init nuxt.js and create server listening on localhost:4000
|
||||
test.before('Init Nuxt.js', async t => {
|
||||
@ -57,6 +56,5 @@ test('/parent/validate-child?key=12345', async t => {
|
||||
|
||||
// Close server and ask nuxt to stop listening to file changes
|
||||
test.after('Closing server and nuxt.js', t => {
|
||||
server.close()
|
||||
nuxt.close()
|
||||
})
|
||||
|
@ -6,7 +6,6 @@ const port = 4005
|
||||
const url = (route) => 'http://localhost:' + port + route
|
||||
|
||||
let nuxt = null
|
||||
let server = null
|
||||
|
||||
// Init nuxt.js and create server listening on localhost:4000
|
||||
test.before('Init Nuxt.js', async t => {
|
||||
@ -36,11 +35,11 @@ test('/404 should display an error too', async t => {
|
||||
|
||||
test('/ with renderAndGetWindow()', async t => {
|
||||
const err = await t.throws(nuxt.renderAndGetWindow(url('/')))
|
||||
t.is(err.response.statusCode, 500)
|
||||
t.true(String(err).includes('Error: socket hang up'))
|
||||
// t.is(err.response.statusCode, 500)
|
||||
})
|
||||
|
||||
// Close server and ask nuxt to stop listening to file changes
|
||||
test.after('Closing server and nuxt.js', t => {
|
||||
server.close()
|
||||
nuxt.close()
|
||||
})
|
||||
|
@ -7,7 +7,6 @@ const port = 4006
|
||||
const url = (route) => 'http://localhost:' + port + route
|
||||
|
||||
let nuxt = null
|
||||
let server = null
|
||||
|
||||
// Init nuxt.js and create server listening on localhost:4000
|
||||
test.before('Init Nuxt.js', async t => {
|
||||
@ -40,6 +39,5 @@ test('Middleware', async t => {
|
||||
|
||||
// Close server and ask nuxt to stop listening to file changes
|
||||
test.after('Closing server and nuxt.js', t => {
|
||||
server.close()
|
||||
nuxt.close()
|
||||
})
|
||||
|
@ -7,7 +7,6 @@ const port = 4007
|
||||
const url = (route) => 'http://localhost:' + port + route
|
||||
|
||||
let nuxt = null
|
||||
let server = null
|
||||
|
||||
// Init nuxt.js and create server listening on localhost:4000
|
||||
test.before('Init Nuxt.js', async t => {
|
||||
@ -101,6 +100,5 @@ test('Check /test.txt with custom serve-static options', async t => {
|
||||
|
||||
// Close server and ask nuxt to stop listening to file changes
|
||||
test.after('Closing server and nuxt.js', t => {
|
||||
server.close()
|
||||
nuxt.close()
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user