forked from Tarnadas/net64plus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.prod.js
107 lines (105 loc) · 2.74 KB
/
webpack.prod.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
const webpack = require('webpack')
const BabiliPlugin = require('babili-webpack-plugin')
const path = require('path')
const HtmlWebpackPlugin = require('html-webpack-plugin')
module.exports = [
{
target: 'electron-renderer',
entry: {
renderer: path.join(__dirname, 'src/renderer.jsx')
},
output: {
filename: 'renderer.jsx',
path: path.join(__dirname, 'build')
},
devtool: 'inline-source-map',
node: {
__dirname: true,
__filename: false,
console: true,
fs: 'empty',
net: 'empty',
tls: 'empty'
},
plugins: [
new webpack.EnvironmentPlugin({
NODE_ENV: 'production',
VERSION: process.env.npm_package_version.slice(-2) === '.0' ? process.env.npm_package_version.slice(0, process.env.npm_package_version.length - 2) : process.env.npm_package_version
}),
new HtmlWebpackPlugin({
filename: 'index.html',
template: 'src/template.html'
}),
new webpack.optimize.ModuleConcatenationPlugin(),
new BabiliPlugin({
keepFnName: true
})
],
externals: {
winprocess: 'require(require("path").resolve(__dirname, "winprocess"))'
},
resolve: {
extensions: [ '.js', '.jsx', '.json' ]
},
module: {
loaders: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel-loader',
query: {
babelrc: false,
presets: [
['env', {
targets: {
electron: '1.6.14'
},
useBuiltIns: true
}]
],
plugins: ['transform-react-jsx']
}
},
{
test: /\.(png|jpg)$/,
loader: 'url-loader',
options: {
limit: 25000,
prefix: path.join(__dirname, 'build')
}
},
{
test: /\.(woff|ttf)$/,
loader: 'url-loader',
options: {
limit: 25000,
prefix: path.join(__dirname, 'build')
}
}
]
}
},
{
target: 'electron',
entry: path.join(__dirname, 'src/index.js'),
output: {
filename: 'index.js',
path: path.join(__dirname, 'build')
},
devtool: 'inline-source-map',
node: {
__dirname: false,
__filename: false
},
plugins: [
new webpack.EnvironmentPlugin({
NODE_ENV: 'production',
VERSION: process.env.npm_package_version.slice(-2) === '.0' ? process.env.npm_package_version.slice(0, process.env.npm_package_version.length - 2) : process.env.npm_package_version
}),
new webpack.optimize.ModuleConcatenationPlugin(),
new BabiliPlugin({
keepFnName: true
})
]
}
]