UNPKG

832 BJavaScriptView Raw
1const path = require('path')
2
3const AssetsPlugin = require('assets-webpack-plugin')
4
5const { clientConfig, serverConfig, } = require('./webpack.config')
6
7// override
8
9/* client */
10clientConfig.entry.client = ['./src/client/entry.test.js']
11// change the client to node env, using jsdom
12clientConfig.output = {
13 path: path.resolve('./test/build/public'),
14 filename: 'client.test.js',
15}
16
17clientConfig.node = { fs: 'empty' }
18
19// remove the assetplugin for client
20clientConfig.plugins = clientConfig.plugins.filter(p => !(p instanceof AssetsPlugin))
21
22
23/* server */
24serverConfig.entry.server = ['./src/server/entry.test.js']
25serverConfig.output = {
26 path: path.resolve('./test/build/server'),
27 filename: 'server.test.js',
28 libraryTarget: 'commonjs2',
29}
30
31module.exports = { clientConfig, serverConfig }