-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathwebpack.config.js
46 lines (42 loc) · 1.05 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
// webpack.config.js
var nodeExternals = require('webpack-node-externals')
var path = require('path')
var webpack = require('webpack')
var config = {
entry: ['whatwg-fetch', 'regenerator-runtime/runtime', path.join(__dirname, 'src', 'index.js')],
devtool: 'source-map',
target: 'node',
output: {
path: path.join(__dirname, '/dist'),
filename: 'cozy-client.js',
library: 'cozy-client-js',
libraryTarget: 'umd',
umdNamedDefine: true
},
module: {
loaders: [
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /(node_modules|bower_components)/
},
{
test: /\.js$/,
loader: 'standard-loader',
exclude: /node_modules|.tmp\/mocha-webpack/
}
]
},
resolve: {
root: path.resolve('./src'),
extensions: ['', '.js']
}
}
if (process.env.NODE_ENV === 'test') {
config.externals = [nodeExternals()]
config.plugins = [
new webpack.ProvidePlugin({ 'btoa': 'btoa' }),
new webpack.EnvironmentPlugin(Object.keys(process.env))
]
}
module.exports = config