-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathwebpack.config.js
55 lines (49 loc) · 1.43 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
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: 'projection-grid.js',
library: 'projection-grid',
libraryTarget: 'umd',
umdNamedDefine: false,
devtoolModuleFilenameTemplate: function (info) {
if (path.isAbsolute(info.absoluteResourcePath)) {
return 'webpack-src:///projection-grid/' + path.relative('.', info.absoluteResourcePath).replace(/\\/g, '/');
}
return info.absoluteResourcePath;
},
},
module: {
loaders: [
// jade
{ test: /\.jade$/, loader: 'babel!jade' },
// jade-end
// es2015
{ test: /\.js$/, exclude: /\bnode_modules\b/, loader: 'babel-loader' },
// es2015-end
{ test: /\.less$/, loader: 'style!css!less' },
{ test: /\.json$/, loader: 'json' },
],
},
babel: { presets: ['es2015'] },
externals: [getExternals()],
resolve: { alias: webpackAlias },
devtool: 'source-map',
};