forked from SaiKiran-JV-2148/s3-plugin-webpack
-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.babel.js
56 lines (49 loc) · 1.1 KB
/
webpack.config.babel.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
56
import path from 'path'
import {DefinePlugin} from 'webpack'
const CONTEXT = path.resolve(__dirname),
{NODE_ENV} = process.env,
createPath = nPath => path.resolve(CONTEXT, nPath),
SRC_PATH = createPath('src'),
NODE_MODULES = createPath('node_modules')
var config = {
context: CONTEXT,
entry: './src/s3_plugin.js',
target: 'node',
output: {
path: createPath('dist'),
library: 'webpack-s3-plugin',
libraryTarget: 'umd',
filename: 's3_plugin.js'
},
plugins: [
new DefinePlugin({
__DEV__: NODE_ENV === 'development' || NODE_ENV === 'test'
})
],
module: {
rules: [
{
enforce: 'pre',
test: /\.js/,
loader: 'eslint-loader',
include: [SRC_PATH],
exclude: [NODE_MODULES]
},
{
test: /\.js/,
loader: 'babel-loader',
include: [SRC_PATH, createPath('test')],
exclude: [NODE_MODULES]
}
]
},
externals: NODE_ENV === 'test' ? [] : [
'cdnizer',
'aws-sdk',
'lodash',
's3',
'recursive-readdir',
'progress'
]
}
module.exports = config