diff --git a/lib/nuxt.js b/lib/nuxt.js index 52e2c3ac64..798941a0de 100644 --- a/lib/nuxt.js +++ b/lib/nuxt.js @@ -43,8 +43,7 @@ class Nuxt { performance: { gzip: { threshold: 0 - }, - prefetch: true + } }, watchers: { webpack: {}, diff --git a/lib/render.js b/lib/render.js index eec45eb82a..d70ebbf449 100644 --- a/lib/render.js +++ b/lib/render.js @@ -93,7 +93,7 @@ export function renderRoute (url, context = {}) { // Add url and isSever to the context context.url = url context.isServer = true - // Call rendertoSting from the bundleRenderer and generate the HTML (will update the context as well) + // Call renderToSting from the bundleRenderer and generate the HTML (will update the context as well) const self = this return co(function * () { let APP = yield self.renderToString(context) @@ -105,8 +105,9 @@ export function renderRoute (url, context = {}) { if (self.options.router.base !== '/') { HEAD += `` } - HEAD += context.styles + HEAD += context.renderResourceHints() + context.renderStyles() APP += `` + APP += context.renderScripts() const html = self.appTemplate({ HTML_ATTRS: 'data-n-head-ssr ' + m.htmlAttrs.text(), BODY_ATTRS: m.bodyAttrs.text(), diff --git a/lib/webpack/client.config.js b/lib/webpack/client.config.js index 92380ad483..2ebdf1551a 100644 --- a/lib/webpack/client.config.js +++ b/lib/webpack/client.config.js @@ -5,8 +5,6 @@ import webpack from 'webpack' import VueSSRClientPlugin from 'vue-server-renderer/client-plugin' import HTMLPlugin from 'html-webpack-plugin' import FriendlyErrorsWebpackPlugin from 'friendly-errors-webpack-plugin' -import ScriptExtHtmlWebpackPlugin from 'script-ext-html-webpack-plugin' -import PreloadWebpackPlugin from 'preload-webpack-plugin' import ProgressBarPlugin from 'progress-bar-webpack-plugin' import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer' import OfflinePlugin from 'offline-plugin' @@ -46,9 +44,6 @@ export default function () { }) // Webpack plugins config.plugins = (config.plugins || []).concat([ - new VueSSRClientPlugin({ - filename: 'client-manifest.json' - }), // Strip comments in Vue code new webpack.DefinePlugin(Object.assign(env, { 'process.env.NODE_ENV': JSON.stringify(this.dev ? 'development' : 'production'), @@ -70,22 +65,13 @@ export default function () { }), // Generate output HTML new HTMLPlugin({ - template: this.options.appTemplatePath + template: this.options.appTemplatePath, + inject: false // <- Resources will be injected using vue server renderer }), - // Add defer to scripts - new ScriptExtHtmlWebpackPlugin({ - defaultAttribute: 'defer' + new VueSSRClientPlugin({ + filename: 'client-manifest.json' }) ]) - - if (!this.dev && this.options.performance.prefetch === true) { - // Add prefetch code-splitted routes - config.plugins.push( - new PreloadWebpackPlugin({ - rel: 'prefetch' - }) - ) - } // client bundle progress bar config.plugins.push( new ProgressBarPlugin()