forked from sqlectron/sqlectron-gui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.prod.config.js
102 lines (101 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
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
// var BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
require('babel-polyfill');
module.exports = {
devtool: 'eval-source-map',
target: 'electron-renderer',
resolve: {
extensions: ['', '.js'],
modulesDirectories: ['node_modules', 'src/renderer'],
},
entry: {
app: './src/renderer/entry.jsx',
vendor: [
// common
'jquery',
// react related
'classnames',
'react',
'react-ace',
'react-dom',
'react-redux',
'react-resizable',
'react-router',
'react-select',
'redux',
'redux-thunk',
// semantic ui
'./vendor/renderer/lato/latofonts.css',
'./vendor/renderer/semantic-ui/semantic.js',
'./vendor/renderer/semantic-ui/semantic.css',
],
},
output: {
path: path.join(__dirname, 'out', 'static'),
filename: '[name].bundle.js',
},
module: {
loaders: [
{
test: /\.jsx?$/,
exclude: /(node_modules|vendor)/,
loaders: ['babel'],
},
{
test: /\.s?css$/,
loader: ExtractTextPlugin.extract(
'style',
'css!sass',
'autoprefixer?browsers=last 2 version',
'sass?includePaths[]=' + path.resolve(__dirname, 'node_modules')
),
},
{
test: /\.png$/,
loader: 'url?mimetype=image/png',
},
{
test: /\.gif$/,
loader: 'url?mimetype=image/gif',
},
{
test: /\.(?:eot|ttf|woff2?|svg)$/,
loader: 'file?name=fonts/[name]-[hash:6].[ext]',
},
{
test: /\.json?$/,
loader: 'json',
},
],
noParse: [/(html2canvas)/],
},
plugins: [
new webpack.optimize.OccurrenceOrderPlugin(true),
new webpack.optimize.DedupePlugin(),
new ExtractTextPlugin('[name].bundle.css'),
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
minChunks: Infinity,
}),
new webpack.optimize.CommonsChunkPlugin({
name: 'common',
}),
new webpack.optimize.UglifyJsPlugin(),
new HtmlWebpackPlugin({
template: 'src/renderer/index.html',
chunksSortMode: 'none',
}),
new webpack.ProvidePlugin({
jQuery: 'jquery',
$: 'jquery',
}),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('production'),
}),
// new BundleAnalyzerPlugin(),
new webpack.NoErrorsPlugin(),
],
};