-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
55 lines (54 loc) · 1.21 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
52
53
54
55
var path = require('path');
var slsw = require('serverless-webpack');
var nodeExternals = require('webpack-node-externals');
var CopyWebpackPlugin = require('copy-webpack-plugin');
module.exports = {
entry: slsw.lib.entries,
target: 'node',
// Generate sourcemaps for proper error messages
devtool: 'source-map',
// Since 'aws-sdk' is not compatible with webpack,
// we exclude all node dependencies
externals: [nodeExternals()],
// Run babel on all .js files and skip those in node_modules
module: {
rules: [
{
test: /\.js$/,
include: __dirname,
exclude: /node_modules/,
use: [
{
loader: 'babel-loader',
options: {
plugins: ["source-map-support", "transform-runtime"],
presets: ['env', 'stage-3'],
},
},
],
},
]
},
plugins: [
// Copy Vali Admin files
new CopyWebpackPlugin([
{
from: 'admin/views',
to: 'views',
},
{
from: 'admin/css',
to: 'css',
},
{
from: 'admin/js',
to: 'js',
}
])
],
output: {
libraryTarget: 'commonjs',
path: path.join(__dirname, '.webpack'),
filename: '[name].js',
},
};