mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-06 21:10:38 +00:00
Resource hints for SPA
This commit is contained in:
parent
d6cb2cbc79
commit
7a9539e74f
@ -7,6 +7,7 @@ import ProgressBarPlugin from 'progress-bar-webpack-plugin'
|
||||
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer'
|
||||
import { resolve } from 'path'
|
||||
import base from './base.config.js'
|
||||
import ScriptExtHtmlWebpackPlugin from 'script-ext-html-webpack-plugin'
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@ -74,6 +75,28 @@ export default function webpackClientConfig () {
|
||||
config.plugins = []
|
||||
}
|
||||
|
||||
// Generate output HTML for SPA
|
||||
config.plugins.push(
|
||||
new HTMLPlugin({
|
||||
filename: 'index.spa.html',
|
||||
template: this.options.appTemplatePath,
|
||||
inject: true,
|
||||
chunksSortMode: 'dependency'
|
||||
})
|
||||
)
|
||||
|
||||
// Resource hints for SPA
|
||||
config.plugins.push(
|
||||
new ScriptExtHtmlWebpackPlugin({
|
||||
preload: [
|
||||
'app',
|
||||
'vendor',
|
||||
'common',
|
||||
'manifest'
|
||||
]
|
||||
})
|
||||
)
|
||||
|
||||
// Generate output HTML for SSR
|
||||
if (this.options.build.ssr) {
|
||||
config.plugins.push(
|
||||
@ -85,16 +108,6 @@ export default function webpackClientConfig () {
|
||||
)
|
||||
}
|
||||
|
||||
// Generate output HTML for SPA
|
||||
config.plugins.push(
|
||||
new HTMLPlugin({
|
||||
filename: 'index.spa.html',
|
||||
template: this.options.appTemplatePath,
|
||||
inject: true,
|
||||
chunksSortMode: 'dependency'
|
||||
})
|
||||
)
|
||||
|
||||
// Generate vue-ssr-client-manifest
|
||||
config.plugins.push(
|
||||
new VueSSRClientPlugin({
|
||||
|
@ -104,6 +104,7 @@
|
||||
"pretty-error": "^2.1.1",
|
||||
"progress-bar-webpack-plugin": "^1.10.0",
|
||||
"resolve-url-loader": "^2.1.0",
|
||||
"script-ext-html-webpack-plugin": "^1.8.5",
|
||||
"serialize-javascript": "^1.4.0",
|
||||
"serve-static": "^1.12.4",
|
||||
"server-destroy": "^1.0.1",
|
||||
|
@ -6039,6 +6039,12 @@ schema-utils@^0.3.0:
|
||||
dependencies:
|
||||
ajv "^5.0.0"
|
||||
|
||||
script-ext-html-webpack-plugin@^1.8.5:
|
||||
version "1.8.5"
|
||||
resolved "https://registry.yarnpkg.com/script-ext-html-webpack-plugin/-/script-ext-html-webpack-plugin-1.8.5.tgz#7a408383d7f3329da8f59d503be25cc39a53f3f3"
|
||||
dependencies:
|
||||
debug "^2.6.8"
|
||||
|
||||
semver-diff@^2.0.0:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/semver-diff/-/semver-diff-2.1.0.tgz#4bbb8437c8d37e4b0cf1a68fd726ec6d645d6d36"
|
||||
|
Loading…
Reference in New Issue
Block a user