Merge branch 'dev' of github.com:nuxt/nuxt.js into dev

This commit is contained in:
Sebastien Chopin 2017-05-22 14:05:26 +02:00
commit 9098854a30

View File

@ -12,6 +12,11 @@ import App from '<%= appPath %>'
import { getContext } from './utils' import { getContext } from './utils'
// Import SSR plugins
<% plugins.forEach(function (plugin) { if (plugin.ssr)
{ %>import <%= plugin.name %> from '<%= r(plugin.src) %>'
<% }}) %>
// Component: <nuxt-child> // Component: <nuxt-child>
Vue.component(NuxtChild.name, NuxtChild) Vue.component(NuxtChild.name, NuxtChild)
// Component: <nuxt-link> // Component: <nuxt-link>
@ -113,20 +118,18 @@ async function createApp (ssrContext) {
delete ctx.redirect delete ctx.redirect
delete ctx.error delete ctx.error
// Includes & Inject external plugins // Inject external plugins
<% plugins.forEach(function (plugin) { <% plugins.forEach(function (plugin) {
if (plugin.ssr) { %> if (plugin.ssr) { %>
let <%= plugin.name %> = require('<%= plugin.src %>')
<%= plugin.name %> = <%= plugin.name %>.default || <%= plugin.name %>
if (typeof <%= plugin.name %> === 'function') { if (typeof <%= plugin.name %> === 'function') {
<%= plugin.name %>(ctx) await <%= plugin.name %>(ctx)
} }
<% } else { %> <% } else { %>
if (process.browser) { if (process.browser) {
let <%= plugin.name %> = require('<%= plugin.src %>') let <%= plugin.name %> = require('<%= plugin.src %>')
<%= plugin.name %> = <%= plugin.name %>.default || <%= plugin.name %> <%= plugin.name %> = <%= plugin.name %>.default || <%= plugin.name %>
if (typeof <%= plugin.name %> === 'function') { if (typeof <%= plugin.name %> === 'function') {
<%= plugin.name %>(ctx) await <%= plugin.name %>(ctx)
} }
} }
<% } <% }