mirror of
https://gitee.com/log4j/pig-ui.git
synced 2024-12-23 13:43:51 +08:00
48 lines
1.7 KiB
JavaScript
48 lines
1.7 KiB
JavaScript
const webpack = require('webpack')
|
|
const merge = require('webpack-merge')
|
|
var config = require('../config')
|
|
var ExtractTextPlugin = require('extract-text-webpack-plugin')
|
|
const base = require('./webpack.base.conf')
|
|
const nodeExternals = require('webpack-node-externals')
|
|
const VueSSRServerPlugin = require('vue-server-renderer/server-plugin')
|
|
var OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
|
|
const utils = require('./utils')
|
|
module.exports = merge(base, {
|
|
module: {
|
|
rules: utils.styleLoaders({
|
|
sourceMap: config.build.productionSourceMap,
|
|
extract: true
|
|
})
|
|
},
|
|
target: 'node',
|
|
devtool: '#source-map',
|
|
entry: './src/entry-server.js',
|
|
output: {
|
|
filename: 'server-bundle.js',
|
|
libraryTarget: 'commonjs2'
|
|
},
|
|
// https://webpack.js.org/configuration/externals/#externals
|
|
// https://github.com/liady/webpack-node-externals
|
|
externals: nodeExternals({
|
|
// do not externalize CSS files in case we need to import it from a dep
|
|
whitelist: /\.css$/
|
|
}),
|
|
plugins: [
|
|
new ExtractTextPlugin({
|
|
filename: utils.assetsPath('css/[name].[contenthash].css')
|
|
}),
|
|
// Compress extracted CSS. We are using this plugin so that possible
|
|
// duplicated CSS from different components can be deduped.
|
|
new OptimizeCSSPlugin({
|
|
cssProcessorOptions: {
|
|
safe: true
|
|
}
|
|
}),
|
|
new webpack.DefinePlugin({
|
|
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development'),
|
|
'process.env.VUE_ENV': '"server"'
|
|
}),
|
|
new VueSSRServerPlugin()
|
|
]
|
|
})
|