forked from microsoft/pagination-control
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
57 lines (52 loc) · 1.44 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
56
57
var _ = require('underscore');
var path = require('path');
var pkg = require('./package');
var webpackAlias = pkg.webpackAlias || {};
try {
webpackAlias = require('./webpack.alias');
} catch (e) { }
function getExternals() {
var deps = _.keys(pkg.peerDependencies);
var externals = _.object(deps, deps);
return _.reduce(_.pairs(webpackAlias), function (exts, pair) {
if (_.has(externals, pair[1])) {
exts[pair[0]] = pair[1];
}
return exts;
}, externals);
}
module.exports = {
entry: path.resolve('./js/index.js'),
output: {
path: path.join(__dirname, 'dist'),
filename: 'pagination-control.js',
library: 'pagination-control',
libraryTarget: 'umd',
umdNamedDefine: false,
devtoolModuleFilenameTemplate: function (info) {
if (path.isAbsolute(info.absoluteResourcePath)) {
return 'webpack-src:///pagination-control-example/' + path.relative('.', info.absoluteResourcePath).replace(/\\/g, '/');
}
return info.absoluteResourcePath;
},
},
module: {
loaders: [
// jade
{ test: /\.jade$/, loader: 'jade-loader' },
// jade-end
// es2015
{
test: /\.(js|es6?)$/,
exclude: /node_modules/,
loader: 'babel-loader',
},
// es2015-end
{ test: /\.js$/, loader: 'source-map-loader' },
],
},
babel: { presets: ['es2015'] },
externals: [getExternals()],
resolve: { alias: webpackAlias },
devtool: 'source-map',
};