-
Notifications
You must be signed in to change notification settings - Fork 12
/
webpack.config.js
36 lines (35 loc) · 1.14 KB
/
webpack.config.js
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
const webpack = require('webpack');
const slsw = require('serverless-webpack');
const nodeExternals = require('webpack-node-externals');
const path = require('path')
module.exports = (async () => {
const accountId = await slsw.lib.serverless.providers.aws.getAccountId();
return {
entry: slsw.lib.entries,
target: 'node',
devtool: 'source-map',
externals: [nodeExternals({
modulesDir: path.join(__dirname, './node_modules')
})],
mode: slsw.lib.webpack.isLocal ? 'development' : 'production',
performance: {
hints: false, // Turn off size warnings for entry points
},
stats: 'minimal', // https://github.com/serverless-heaven/serverless-webpack#stats
plugins: [
new webpack.DefinePlugin({
AWS_ACCOUNT_ID: `${accountId}`,
}),
],
module: {
rules: [
{
test: /\.js$/,
use: ['babel-loader'],
include: __dirname,
exclude: /node_modules/,
},
],
},
};
})();