webpack.server.conf.js
1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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');
let webpackConfig = merge(baseConfig, {
entry: {
app: './apps/entry-server.js',
},
target: 'node',
resolve: {
alias: {
'create-api': 'common/create-api-server.js',
'report-error': 'common/report-error-server.js',
},
},
module: {
rules: [
{
test: /\.s?css$/,
use: 'ignore-loader',
},
{
test: /\.styl(us)?$/,
use: 'ignore-loader',
},
{
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
use: 'ignore-loader',
},
{
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
use: 'ignore-loader',
},
],
},
output: {
libraryTarget: 'commonjs2',
},
externals: nodeExternals({
whitelist: [/cube-ui/],
}),
plugins: [
new VueSSRServerPlugin({
filename: '../../manifest.server.json',
}),
new webpack.DefinePlugin({
'process.env.VUE_ENV': '"server"',
}),
],
});
module.exports = webpackConfig;