forked from auth0/auth0.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
71 lines (62 loc) · 1.44 KB
/
webpack.config.js
File metadata and controls
71 lines (62 loc) · 1.44 KB
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
var fs = require('fs');
var webpack = require('webpack');
var CustomVarLibraryNamePlugin = require('webpack-custom-var-library-name-plugin');
var path = require('path');
var entryPoints = {
'auth0-js': ['./src/index.js']
};
var nameOverrides = {
'auth0-js': {
var: 'auth0',
file: 'auth0'
}
};
var files = fs.readdirSync(path.join(__dirname, './plugins/'));
for (var a = 0; a < files.length; a++) {
var pluginName = files[a] + '-auth0-plugin';
var className = capitalize(files[a]) + 'Auth0Plugin';
entryPoints[pluginName] = ['./plugins/' + files[a] + '/index.js'];
nameOverrides[pluginName] = {
var: className,
file: pluginName
};
}
module.exports = {
devtool: 'eval',
entry: entryPoints,
output: {
path: path.join(__dirname, '../build'),
filename: '[name].js',
library: '[name]',
libraryTarget: 'umd',
publicPath: 'https://localhost:3000/'
},
resolve: {
extensions: ['', '.webpack.js', '.web.js', '.js']
},
progress: true,
watch: true,
watchOptions: {
aggregateTimeout: 500,
poll: true
},
keepalive: true,
stats: {
colors: true,
modules: true,
reasons: true
},
stylus: {
preferPathResolver: 'webpack'
},
plugins: [
new CustomVarLibraryNamePlugin({
name: nameOverrides
})
// new webpack.HotModuleReplacementPlugin(),
// new webpack.NoErrorsPlugin()
]
};
function capitalize(name) {
return name[0].toUpperCase() + name.slice(1);
}