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');
|
2017-11-24 01:39:53 +00:00
|
|
|
const pkg = require('../package.json');
|
2016-11-10 00:01:10 +00:00
|
|
|
|
2017-11-26 20:45:40 +00:00
|
|
|
const PORT = pkg.dev['dev-server-port'];
|
|
|
|
|
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({
|
2018-10-17 16:42:33 +00:00
|
|
|
'process.env.APP_RENDER_URL': JSON.stringify(`http://localhost:${PORT}/renderer.html`),
|
2017-05-03 17:48:23 +00:00
|
|
|
'process.env.NODE_ENV': JSON.stringify('development'),
|
|
|
|
'process.env.INSOMNIA_ENV': JSON.stringify('development')
|
|
|
|
})
|
2017-11-26 20:45:40 +00:00
|
|
|
];
|
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,
|
2018-06-25 17:42:50 +00:00
|
|
|
entry: ['./main.development.js'],
|
2017-03-03 01:44:07 +00:00
|
|
|
output: output,
|
2016-11-10 00:01:10 +00:00
|
|
|
node: {
|
2017-11-04 20:53:40 +00:00
|
|
|
__dirname: false // Use node.js __dirname
|
2016-11-10 00:01:10 +00:00
|
|
|
},
|
2017-05-03 17:48:23 +00:00
|
|
|
target: 'electron-main',
|
|
|
|
plugins: plugins
|
2016-11-10 00:01:10 +00:00
|
|
|
};
|