forked from DoctorBud/graphviz-viewer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
87 lines (80 loc) · 1.93 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var CopyWebpackPlugin = require('copy-webpack-plugin');
var path = require('path');
var dist = path.join(__dirname, 'docs');
var app = path.resolve(__dirname);
var bs = path.join(__dirname, 'node_modules/bootstrap');
var production = process.env.BUILD === 'production';
var config = {
entry: './app.js',
output: {
path: dist,
filename: "graphviz-viewer.js"
},
module: {
loaders: [
{
test: /\.css$/,
loader: 'style!css'
},
{
test: /\.json$/,
loader: 'json-loader'
},
{
// Reference: https://github.com/babel/babel-loader
test: /\.js$/,
loader: 'babel',
query: {
// https://github.com/babel/babel-loader#options
cacheDirectory: true,
presets: ['es2015']
},
exclude: /node_modules/,
include: [app]
},
{
test: /\.(png|jpg|jpeg|gif|svg|woff|woff2|ttf|eot|txt|ico)$/,
loader: 'file',
include: [bs]
}
]
},
node: {
fs: 'empty'
},
devServer: {
inline: false,
contentBase: dist
},
plugins: [
new HtmlWebpackPlugin({
template: './index.html',
inject: 'head',
baseUrl: '/'
}),
new CopyWebpackPlugin([
{ from: 'examples/biological.gv' }
])
]
};
if (production) {
config.plugins.push(
// Reference: http://webpack.github.io/docs/list-of-plugins.html#uglifyjsplugin
// Minify all javascript, switch loaders to minimizing mode
new webpack.optimize.UglifyJsPlugin({
sourceMap: false,
// mangle: false,
mangle: {
except: ['$', '$scope', '$compile', '$timeout', '$rootScope', '$http',
'$rootScopeProvider',
'$location', '$state', '$q']
},
compress: {
warnings: false
}
})
);
}
module.exports = config;