2017-05-03 17:48:23 +00:00
|
|
|
const webpack = require('webpack');
|
2017-03-03 01:44:07 +00:00
|
|
|
const path = require('path');
|
|
|
|
const productionConfig = require('./webpack.config.production.babel');
|
2016-11-10 00:01:10 +00:00
|
|
|
|
2017-03-03 20:09:08 +00:00
|
|
|
let devtool;
|
2017-05-03 17:48:23 +00:00
|
|
|
let plugins;
|
2017-03-03 01:44:07 +00:00
|
|
|
const output = {
|
2017-05-03 17:48:23 +00:00
|
|
|
libraryTarget: 'commonjs2',
|
|
|
|
filename: 'main.min.js'
|
2017-03-03 01:44:07 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
if (process.env.NODE_ENV === 'development') {
|
|
|
|
output.path = path.join(__dirname, '../app');
|
2017-03-03 20:09:08 +00:00
|
|
|
devtool = 'eval-source-map';
|
2017-05-03 17:48:23 +00:00
|
|
|
plugins = [
|
|
|
|
new webpack.DefinePlugin({
|
|
|
|
'process.env.NODE_ENV': JSON.stringify('development'),
|
|
|
|
'process.env.INSOMNIA_ENV': JSON.stringify('development')
|
|
|
|
})
|
|
|
|
]
|
2017-03-03 01:44:07 +00:00
|
|
|
} else {
|
|
|
|
output.path = path.join(__dirname, '../build');
|
2017-03-03 20:09:08 +00:00
|
|
|
devtool = productionConfig.devtool;
|
2017-05-03 17:48:23 +00:00
|
|
|
plugins = productionConfig.plugins;
|
2017-03-03 01:44:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = {
|
2016-11-10 00:01:10 +00:00
|
|
|
...productionConfig,
|
2017-03-03 20:09:08 +00:00
|
|
|
devtool: devtool,
|
2016-11-10 00:01:10 +00:00
|
|
|
entry: [
|
2016-11-10 02:53:06 +00:00
|
|
|
'./main.development.js'
|
2016-11-10 00:01:10 +00:00
|
|
|
],
|
2017-03-03 01:44:07 +00:00
|
|
|
output: output,
|
2016-11-10 00:01:10 +00:00
|
|
|
node: {
|
|
|
|
__dirname: false,
|
|
|
|
__filename: false
|
|
|
|
},
|
2017-05-03 17:48:23 +00:00
|
|
|
target: 'electron-main',
|
|
|
|
plugins: plugins
|
2016-11-10 00:01:10 +00:00
|
|
|
};
|