forked from dtzinov/ggrc-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
70 lines (68 loc) · 1.85 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
58
59
60
61
62
63
64
65
66
67
68
69
70
/*
Copyright (C) 2017 Google Inc.
Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
*/
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var _ = require('lodash');
var path = require('path');
var GGRC = {
get_dashboard_modules: function () {
return _.compact(_.map(process.env.GGRC_SETTINGS_MODULE.split(' '), function (module) {
var name;
if (/^ggrc/.test(module)) {
name = module.split('.')[0];
}
if (module === 'development') {
name = 'ggrc';
}
if (!name) {
return '';
}
return './src/' + name + '/assets/assets';
}));
}
};
module.exports = {
entry: {
dashboard: GGRC.get_dashboard_modules()
},
output: {
filename: '[name]_.js',
path: path.join(__dirname, './src/ggrc/assets/stylesheets/'),
publicPath: '/src/ggrc/static/'
},
module: {
loaders: [{
test: /\.woff(\?v=\d+\.\d+\.\d+)?$/,
loader: 'url?limit=10000&mimetype=application/font-woff'
}, {
test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/,
loader: 'url?limit=10000&mimetype=application/font-woff'
}, {
test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/,
loader: 'url?limit=10000&mimetype=application/octet-stream'
}, {
test: /\.eot(\?v=\d+\.\d+\.\d+)?$/,
loader: 'file'
}, {
test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
loader: 'url?limit=10000&mimetype=image/svg+xml'
}, {
test: /\.css$/,
loader: ExtractTextPlugin.extract('style-loader', 'css-loader')
}, {
test: /\.s[ca]ss$/,
loader: ExtractTextPlugin.extract('style-loader', 'css-loader!sass-loader')
}]
},
resolve: {
root: ['node_modules', 'bower_components'].map(function (dir) {
return path.join(__dirname, dir);
})
},
plugins: [
new ExtractTextPlugin('[name].css', {
allChunks: true
})
]
};