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',
|
2018-12-12 17:36:11 +00:00
|
|
|
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'),
|
2018-12-12 17:36:11 +00:00
|
|
|
'process.env.INSOMNIA_ENV': JSON.stringify('development'),
|
2020-08-12 20:59:30 +00:00
|
|
|
'process.env.RELEASE_DATE': JSON.stringify(new Date()),
|
2018-12-12 17:36:11 +00:00
|
|
|
}),
|
2017-11-26 20:45:40 +00:00
|
|
|
];
|
2017-03-03 01:44:07 +00:00
|
|
|
} else {
|
2020-08-22 05:59:56 +00:00
|
|
|
output.path = path.join(__dirname, '../build', process.env.APP_ID);
|
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: {
|
2018-12-12 17:36:11 +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',
|
2018-12-12 17:36:11 +00:00
|
|
|
plugins: plugins,
|
2016-11-10 00:01:10 +00:00
|
|
|
};
|