-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.js
57 lines (55 loc) · 1.31 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 path = require('path');
var grunt = require('grunt');
var webpack = require('webpack');
var entries = grunt.file.expand({cwd: path.resolve('src')}, "*").reduce(
function(map, page) {
if (page.match(/.js$/)) {
map[page.slice(0, page.length - 3)] = "./" + page;
}
return map;
}, {});
module.exports = {
context: __dirname + "/src",
entry: entries,
output: {
path: path.join(__dirname, "public", "js"),
filename: '[name].min.js'
},
module: {
loaders: [
{
test: /\.coffee$/,
loaders: [ 'coffee-loader', 'cjsx-loader' ],
include: path.join(__dirname, 'src')
},
{
test: /\.js$/,
loaders: ['babel-loader?stage=1'],
include: path.join(__dirname, 'src'),
exclude: /node_modules/
},
{ test: /\.css$/, loader: "style-loader!css-loader" },
{ test: /\.scss$/, loader: "style!css!sass" },
{ test: /\.svg$/, loader: "raw-loader" }
]
},
externals: {
"vega": "vg",
"d3": "d3",
"datalib": "dl",
"react": "React",
"react-dom": "ReactDOM",
"lodash": "_"
},
plugins: [
new webpack.optimize.UglifyJsPlugin({minimize: true})
],
resolve: {
extensions: ['', '.js', '.json', '.coffee']
},
resolveLoader: {
modulesDirectories: [
'node_modules'
]
}
}