我有 webpack.server.config
const merge = require('webpack-merge')
const webpack = require('webpack')
const nodeExternals = require('webpack-node-externals')
const baseConfig = require('./webpack.base.conf.js')
const VueSSRServerPlugin = require('vue-server-renderer/server-plugin')
const utils = require('./utils')
const config = require('../config')
module.exports = merge(baseConfig, {
entry: './src/entry-server.js',
target: 'node',
devtool: 'source-map',
output: {
path: config.build.assetsRoot,
filename: 'server.js',
libraryTarget: 'commonjs2'
},
externals: nodeExternals({
whitelist: /\.css$\.vue$/
}),
plugins: [
new webpack.DefinePlugin({
'process.env': 'production'
}),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
}),
new VueSSRServerPlugin()
]
})
但如果我运行npm run build server
- 抛出错误
ERROR in ./~/extract-text-webpack-plugin/loader.js? {"omit":1,"remove":true}!./~/vue-style-loader!./~/css-loader?{"minimize":true,"sourceMap":true}!./~/vue-loader/lib/style-compiler?{"vue":true,"id":"data-v-42aa77cc","scoped":true,"hasInlineConfig":false}!./~/vue-loader/lib/selector.js?type=styles&index=0!./src/components/about-page.vue
Module build failed: Error: "extract-text-webpack-plugin" loader is used
without the corresponding plugin, refer to
https://github.com/webpack/extract-text-webpack-plugin for the usage
example
at Object.module.exports.pitch (D:\web\transport-
serverSide\node_modules\extract-text-webpack-plugin\loader.js:25:9)
@ ./src/components/about-page.vue 3:4-388
@ ./~/babel-loader/lib!./~/vue-loader/lib/selector.js?
type=script&index=0!./src/components/Top.vue
@ ./src/components/Top.vue
@ ./~/babel-loader/lib!./~/vue-loader/lib/selector.js?
type=script&index=0!./src/components/Main.vue
@ ./src/components/Main.vue
@ ./src/router/index.js
@ ./src/app.js
@ ./src/entry-server.js
如何设置 webpack 或者我可以上课吗?Vue.js 官方网站上关于设置的信息不是很丰富也许我需要更改webpack.base.config 的逻辑?如果有人可以就主题主题或ssr + express的主题提供帮助-我将非常感激