app/config/webpack.config.renderer.js
crusader e925485135 ing
2018-09-27 18:44:56 +09:00

35 lines
873 B
JavaScript

var fse = require('fs-extra');
const util = require('util');
const webpack = require('webpack');
const { getReplacements } = require('./app-info');
const { hasProcessFlag, root } = require('./helpers.js');
const replacements = getReplacements();
const EVENT = process.env.npm_lifecycle_event || '';
const PROD = EVENT.includes('prod');
module.exports = function (config) {
config.target = 'electron-renderer';
config.output = {
path: PROD ? root('build', 'dist') : root('build', 'dev'),
filename: '[name].js',
crossOriginLoading: false,
};
config.plugins.push(
new webpack.DefinePlugin(
Object.assign({}, replacements, {
__PROCESS_KIND__: JSON.stringify('renderer'),
})
)
);
var json = util.inspect(config, { showHidden: false, depth: null });
fse.writeFileSync('webpack.js', json, 'utf8');
return config;
};