npm run build生成server-build文件夹里的内容不是vue-ssr-erver-bundle.json'文件
但是package.json和webpack.config.server.js都和课程远吗一致。
奇怪的是,我下载课程源码本地打包也是这样,没有生成vue-ssr-erver-bundle.json
webpack.config.server.js
const path = require('path') const ExtractPlugin = require('extract-text-webpack-plugin') const webpack = require('webpack') const merge = require('webpack-merge') const baseConfig = require('./webpack.config.base') const VueServerPlugin = require('vue-server-renderer/server-plugin') let config const isDev = process.env.NODE_ENV === 'development' const plugins = [ new ExtractPlugin('styles.[contentHash:8].css'), new webpack.DefinePlugin({ 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development'), 'process.env.VUE_ENV': '"server"' }) ] if (isDev) { plugins.push(new VueServerPlugin()) } config = merge(baseConfig, { target: 'node', entry: path.join(__dirname, '../client/server-entry.js'), devtool: 'source-map', output: { libraryTarget: 'commonjs2', filename: 'server-entry.js', path: path.join(__dirname, '../server-build') }, externals: Object.keys(require('../package.json').dependencies), module: { rules: [ { test: /\.styl/, use: ExtractPlugin.extract({ fallback: 'vue-style-loader', use: [ 'css-loader', { loader: 'postcss-loader', options: { sourceMap: true } }, 'stylus-loader' ] }) } ] }, plugins }) config.resolve = { alias: { // server-model.js 'model': path.join(__dirname, '../client/model/server-model.js') } } module.exports = config
package.json
"scripts": { "test": "echo \"Error: no test specified\" && exit 1", "build:client": "cross-env NODE_ENV=production webpack --config build/webpack.config.client.js", "build:server": "cross-env NODE_ENV=production webpack --config build/webpack.config.server.js", "build": "npm run clean && npm run build:client && npm run build:server", // 略 },