Commit c4d3ab9d authored by Evan You's avatar Evan You

update setup per changes

parent 996266e4
...@@ -5,7 +5,7 @@ const clientConfig = require('./webpack.client.config') ...@@ -5,7 +5,7 @@ const clientConfig = require('./webpack.client.config')
const serverConfig = require('./webpack.server.config') const serverConfig = require('./webpack.server.config')
module.exports = function setupDevServer (app, cb) { module.exports = function setupDevServer (app, cb) {
let bundle, template, serverManifest, clientManifest let bundle, template, clientManifest
// modify client config to work with hot middleware // modify client config to work with hot middleware
clientConfig.entry.app = ['webpack-hot-middleware/client', clientConfig.entry.app] clientConfig.entry.app = ['webpack-hot-middleware/client', clientConfig.entry.app]
...@@ -26,14 +26,11 @@ module.exports = function setupDevServer (app, cb) { ...@@ -26,14 +26,11 @@ module.exports = function setupDevServer (app, cb) {
const fs = devMiddleware.fileSystem const fs = devMiddleware.fileSystem
const readFile = file => fs.readFileSync(path.join(clientConfig.output.path, file), 'utf-8') const readFile = file => fs.readFileSync(path.join(clientConfig.output.path, file), 'utf-8')
template = readFile('index.html') template = readFile('index.html')
clientManifest = JSON.parse(readFile('vue-ssr-manifest-client.json')) clientManifest = JSON.parse(readFile('vue-ssr-client-manifest.json'))
if (bundle && serverManifest) { if (bundle && serverManifest) {
cb(bundle, { cb(bundle, {
template, template,
manifest: { clientManifest
server: serverManifest,
client: clientManifest
}
}) })
} }
}) })
...@@ -54,14 +51,10 @@ module.exports = function setupDevServer (app, cb) { ...@@ -54,14 +51,10 @@ module.exports = function setupDevServer (app, cb) {
// read bundle generated by vue-ssr-webpack-plugin // read bundle generated by vue-ssr-webpack-plugin
bundle = JSON.parse(readFile('vue-ssr-bundle.json')) bundle = JSON.parse(readFile('vue-ssr-bundle.json'))
serverManifest = JSON.parse(readFile('vue-ssr-manifest-server.json'))
if (template && clientManifest) { if (template && clientManifest) {
cb(bundle, { cb(bundle, {
template, template,
manifest: { clientManifest
server: serverManifest,
client: clientManifest
}
}) })
} }
}) })
......
...@@ -38,13 +38,10 @@ if (isProd) { ...@@ -38,13 +38,10 @@ if (isProd) {
const template = fs.readFileSync(resolve('./dist/index.html'), 'utf-8') const template = fs.readFileSync(resolve('./dist/index.html'), 'utf-8')
renderer = createRenderer(bundle, { renderer = createRenderer(bundle, {
template, template,
// server and client manifests are optional, but they allow the renderer // The client manifests are optional, but it allows the renderer
// to automatically add preload/prefetch links and directly add <script> // to automatically infer preload/prefetch links and directly add <script>
// tags for any async chunks used during render, avoiding waterfall requests. // tags for any async chunks used during render, avoiding waterfall requests.
manifest: { clientManifest: require('./dist/vue-ssr-client-manifest.json')
server: require('./dist/vue-ssr-manifest-server.json'),
client: require('./dist/vue-ssr-manifest-client.json')
}
}) })
} else { } else {
// In development: setup the dev server with watch and hot-reload, // In development: setup the dev server with watch and hot-reload,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment