-
Notifications
You must be signed in to change notification settings - Fork 65
/
webpack.map.config.js
69 lines (61 loc) · 2.04 KB
/
webpack.map.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
'use strict';
var path = require('path'),
webpack = require('webpack'),
nodeModulesPath = path.join(__dirname, 'node_modules');
var js_root_detail = './map_detail/';
var js_detail_dist = path.join(__dirname, './dist/map_detail/origin');
var js_detail_dist_min = path.join(__dirname, './dist/map_detail/min');
// 0 stands for development, 1 stands for production
// for development mode: NODE_ENV=0 webpack
// for production mode: NODE_ENV=1 webpack
var ENV = !!(+process.env.NODE_ENV || 0);
module.exports = [{
name: 'details',
entry: {
earthquake: js_root_detail + 'bubble/earthquake/earthquake.js',
mapbubble: js_root_detail + 'bubble/mapbubble/mapbubble.js',
twpopulation: js_root_detail + 'choropleth/tw/twpopulation.js',
unemployment: js_root_detail + 'choropleth/us/unemployment.js',
historytwpopulation: js_root_detail + 'combine/twhistorypopulation.js',
interactive_line: js_root_detail + 'interactive/line/line.js',
interactive_marker: js_root_detail + 'interactive/marker/marker.js',
interactive_polygon: js_root_detail + 'interactive/multipolygon/multipolygon.js',
simple: js_root_detail + 'interactive/simple/simple.js',
ortho_line: js_root_detail + 'orthographic/line/line.js',
ortho_marker: js_root_detail + 'orthographic/marker/marker.js',
ortho_polygon: js_root_detail + 'orthographic/multipolygon/multipolygon.js'
},
output: {
path: ENV ? js_detail_dist_min : js_detail_dist,
filename: ENV ? '[name].min.js': '[name].js'
},
module: {
loaders: [
{
test: [/\.jsx$/, /\.js$/],
include: /detail/,
loaders: ["jsx-loader"],
},
{
test: /\.css$/,
loader: 'style-loader!css-loader'
}
],
},
resolve: {
extensions: ['', '.webpack.js', '.web.js', '.js', '.jsx']
},
plugins: ENV ? [
new webpack.optimize.UglifyJsPlugin({
sourceMap: false,
mangle: false
}),
new webpack.ProvidePlugin({
'd3': 'd3'
})
]: [
new webpack.ProvidePlugin({
'd3': 'd3'
})
]
}];