-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
44 lines (40 loc) · 1022 Bytes
/
webpack.config.js
File metadata and controls
44 lines (40 loc) · 1022 Bytes
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
const slsw = require('serverless-webpack');
const nodeExternals = require('webpack-node-externals');
const path = require('path');
const injectMocks = (entries) =>
Object.keys(entries).reduce((e, key) => {
e[key] = ['regenerator-runtime/runtime', './test/int/mocks.js', entires[key]];
return e;
}, {});
const includeMocks = () => slsw.lib.webpack.isLocal && process.env.REPLAY !== 'bloody';
const entry = includeMocks() ? injectMocks(slsw.lib.entries) : slsw.lib.entries;
module.exports = {
entry,
output: {
libraryTarget: 'commonjs',
path: path.join(__dirname, '.webpack'),
filename: '[name].js'
},
optimization: {
minimize: false
},
target: 'node',
mode: slsw.lib.webpack.isLocal ? 'development' : 'production',
externals: [
nodeExternals()
],
module: {
rules: [
{
test: /\.js$/,
use: [
{
loader: 'babel-loader',
}
],
include: __dirname,
exclude: /node_modules/
}
]
}
};