webpack.server.conf.js
951 Bytes
const webpack = require('webpack');
const merge = require('webpack-merge');
const nodeExternals = require('webpack-node-externals');
const VueSSRServerPlugin = require('vue-server-renderer/server-plugin');
let baseConfig = require('./webpack.base.conf');
const pkg = require('../package.json');
const isProd = process.env.NODE_ENV === 'production';
let webpackConfig = merge(baseConfig, {
entry: {
app: './apps/entry-server.js'
},
devtool: isProd ? 'source-map' : 'cheap-module-source-map',
target: 'node',
resolve: {
alias: {
'create-api': 'common/create-api-server.js'
}
},
output: {
libraryTarget: 'commonjs2',
},
externals: nodeExternals({
whitelist: [/\.css$/, /cube-ui/]
}),
plugins: [
new VueSSRServerPlugin({
filename: `yoho-ssr-server-${pkg.version}.json`
}),
new webpack.DefinePlugin({
'process.env.VUE_ENV': '"server"'
})
]
});
module.exports = webpackConfig;