{"size": 1292, "ext": "js", "max_stars_repo_path": "webpack.configs.js", "max_stars_repo_name": "jordanbtucker/electron-init", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "webpack.configs.js", "max_issues_repo_name": "jordanbtucker/electron-init", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "webpack.configs.js", "max_forks_repo_name": "jordanbtucker/electron-init", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 20.1875, "max_line_length": 104, "alphanum_fraction": 0.6524767802}
const {HotModuleReplacementPlugin} = require('webpack')
const HTMLWebpackPlugin = require('html-webpack-plugin')

const isProduction = process.env.NODE_ENV === 'production'

const baseConfig = {
	mode: isProduction ? 'production' : 'development',
	module: {
		rules: [
			{
				test: /\.js$/,
				exclude: /node_modules/,
				use: {
					loader: 'babel-loader',
				},
			},
		],
	},
}

const mainConfig = Object.assign({}, baseConfig, {
	entry: [
		isProduction ? './src/main/index.js' : './src/main/index.dev.js',
	],
	output: {
		filename: 'main.js',
	},
	target: 'electron-main',
})

const rendererConfig = Object.assign({}, baseConfig, {
	devServer: {
		hot: true,
	},
	entry: [
		isProduction ? './src/renderer/index.js' : './src/renderer/index.dev.js',
	],
	output: {
		filename: 'renderer.js',
	},
	plugins: [
		new HTMLWebpackPlugin({
			template: 'src/renderer/index.html',
			filename: 'index.html',
		}),
	],
	target: 'electron-renderer',
})

rendererConfig.module.rules.push({
	test: /\.css$/,
	use: ['style-loader', 'css-loader'],
})

if (!isProduction) {
	rendererConfig.entry.push('webpack/hot/dev-server', 'webpack-dev-server/client?http://localhost:8080/')
	rendererConfig.plugins.push(new HotModuleReplacementPlugin())
}

module.exports = {
	mainConfig,
	rendererConfig,
}
