forked from sqlectron/sqlectron-gui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.prod.config.js
107 lines (106 loc) · 2.57 KB
/
webpack.prod.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
/* eslint no-var: 0 */
var path = require('path');
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
require('babel-polyfill');
module.exports = {
devtool: 'eval-source-map',
target: 'electron',
resolve: {
extensions: ['', '.js'],
modulesDirectories: ['node_modules', 'src/renderer'],
},
entry: {
app: './src/renderer/entry.jsx',
vendorCommon: [
'jquery',
'lodash',
],
vendorCommonReact: [
'classnames',
'react',
'react-ace',
'react-dom',
'react-redux',
'react-resizable',
'react-router',
'react-select',
'redux',
'redux-thunk',
],
vendorSemanticUI: [
'./src/renderer/vendor/lato/latofonts.css',
'./src/renderer/vendor/semantic-ui/semantic.js',
'./src/renderer/vendor/semantic-ui/semantic.css',
],
},
output: {
path: path.join(__dirname, 'app', 'out', 'static'),
filename: '[name].bundle.js',
},
module: {
loaders: [
{
test: /\.jsx?$/,
exclude: /(node_modules|src\/renderer\/vendor)/,
loaders: ['babel'],
},
{
test: /\.s?css$/,
loaders: [
'style',
'css',
'autoprefixer?browsers=last 2 version',
'sass?includePaths[]=' + path.resolve(__dirname, 'node_modules'),
],
},
{
test: /\.png$/,
loader: 'url?mimetype=image/png',
},
{
test: /\.(?:eot|ttf|woff2?|svg)$/,
loader: 'file?name=fonts/[name]-[hash:6].[ext]',
},
{
test: /\.json?$/,
loader: 'json',
},
],
noParse: [/html2canvas/],
},
plugins: [
new webpack.optimize.CommonsChunkPlugin({
name: 'vendorCommon',
filename: 'vendor-common.bundle.js',
children: true,
}),
new webpack.optimize.CommonsChunkPlugin({
name: 'vendorCommonReact',
filename: 'vendor-common-react.bundle.js',
children: true,
}),
new webpack.optimize.CommonsChunkPlugin({
name: 'vendorSemanticUI',
filename: 'vendor-semantic-ui.bundle.js',
children: true,
}),
new HtmlWebpackPlugin({
template: 'src/renderer/index.html',
}),
new webpack.ProvidePlugin({
Radium: 'radium',
jQuery: 'jquery',
$: 'jquery',
_: 'lodash',
}),
new webpack.optimize.UglifyJsPlugin({
compressor: { warnings: false },
}),
new webpack.optimize.DedupePlugin(),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('production'),
}),
new webpack.NoErrorsPlugin(),
],
};