forked from yhat/rodeo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
114 lines (113 loc) · 3 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
const pkg = require('./package.json'),
path = require('path'),
webpack = require('webpack'),
CompressionPlugin = require('compression-webpack-plugin');
module.exports = [{
context: path.join(__dirname, 'src'),
devtool: 'source-map',
entry: {
startup: [
'./browser/entry/startup'
],
main: [
'./browser/entry/main'
],
'free-tabs-only': [
'./browser/entry/free-tabs-only'
]
},
externals: {
'ascii-table': 'AsciiTable',
jquery: 'jQuery',
ace: 'ace',
ipc: 'ipc'
},
module: {
loaders: [
{ test: /\.json/, loader: 'json' },
{ test: /\.less$/, loader: 'style!css!less' },
{ test: /\.css$/, loader: 'style!css' },
{ test: /\.(png|gif)$/, loader: 'url?name=[name].[hash].[ext]&limit=8192&&outputPath=app' }, // inline base64 URLs for <=8k images, direct URLs for the rest
{ test: /\.svg$/, loaders: ['file?name=[name].[hash].[ext]', 'svgo?useConfig=svgoConfig1&outputPath=app'] },
{ test: /\.(md|py)$/, loader: 'raw' }, // because we sometimes treat it differently based on the context (i.e., code)
{ test: /\.ya?ml$/, loader: 'json!yaml' }, // some things we want to change often, so it goes in config files
{
test: /\.jsx?$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel',
cacheDirectory: true,
query: {
plugins: [
'lodash',
'transform-runtime',
'transform-react-remove-prop-types',
'transform-react-constant-elements',
'transform-react-inline-elements'
],
presets: ['react', 'es2015']
}
},
{
test: /\.jsx?$/,
include: [
path.resolve(__dirname, 'node_modules/rulejs')
],
loader: 'babel',
cacheDirectory: true,
query: {
plugins: ['lodash'],
presets: ['es2015']
}
}
]
},
node: {
__filename: true,
__dirname: true
},
plugins: [
new webpack.optimize.OccurrenceOrderPlugin(),
new webpack.NoErrorsPlugin(),
new webpack.optimize.DedupePlugin(),
new webpack.DefinePlugin({
__APP_NAME__: JSON.stringify(pkg.name),
__VERSION__: JSON.stringify(pkg.version)
}),
new webpack.optimize.UglifyJsPlugin ({
beautify: false,
comments: false,
compress: {
sequences: true,
booleans: true,
loops: true,
unused: true,
warnings: false,
// drop_console: true,
unsafe: true
},
test: /\.(js|jsx)$/
}),
new CompressionPlugin ({
asset: '[path].gz [query]',
algorithm: 'gzip',
test: /\.js$|\.html$/,
threshold: 10240,
minRatio: 0.8
})
],
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'app')
},
stats: {
colors: true
},
svgoConfig1: {
plugins: [
{removeTitle: true},
{convertColors: {shorthex: false}},
{convertPathData: false}
]
},
target: 'electron-renderer'
}];