-
Notifications
You must be signed in to change notification settings - Fork 9
/
webpack.config.js
51 lines (50 loc) · 1.33 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
const path = require('path');
const CopyPlugin = require('copy-webpack-plugin');
// eslint-disable-next-line import/no-extraneous-dependencies
const nodeExternals = require('webpack-node-externals');
// eslint-disable-next-line import/no-extraneous-dependencies
const slsw = require('serverless-webpack');
module.exports = {
entry: slsw.lib.entries,
target: 'node',
mode: 'production',
externals: [nodeExternals()],
devtool: 'source-map',
module: {
rules: [
{
test: /\.js$/,
use: [
{
loader: 'babel-loader',
options: {
presets: [['env', { targets: { node: '6.10' } }]]
}
}
]
}
]
},
plugins: [
new CopyPlugin([
{ from: './migrations/**/*.*', to: '' },
{ from: './config/config.js', to: 'config/config.js' }
])
],
resolve: {
modules: ['node_modules', './'],
alias: {
'@models': path.resolve(__dirname, 'models/'),
'@utils': path.resolve(__dirname, 'utils/'),
'@daos': path.resolve(__dirname, 'daos/'),
'@services': path.resolve(__dirname, 'services/')
},
extensions: ['.js', '.jsx', '.react.js'],
mainFields: ['browser', 'jsnext:main', 'main']
},
output: {
libraryTarget: 'commonjs',
path: path.join(__dirname, '.webpack'),
filename: '[name].js'
}
};