2018-05-05 20:14:50 +00:00
|
|
|
import * as common from './webpack.common'
|
2016-05-24 19:12:06 +00:00
|
|
|
|
2017-10-28 18:08:07 +00:00
|
|
|
import * as webpack from 'webpack'
|
2020-07-08 08:41:20 +00:00
|
|
|
import merge from 'webpack-merge'
|
|
|
|
import MiniCssExtractPlugin from 'mini-css-extract-plugin'
|
2018-04-08 04:25:11 +00:00
|
|
|
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer'
|
2016-05-24 19:12:06 +00:00
|
|
|
|
2017-10-28 18:08:07 +00:00
|
|
|
const config: webpack.Configuration = {
|
2018-05-04 06:16:32 +00:00
|
|
|
mode: 'production',
|
2017-04-18 07:05:26 +00:00
|
|
|
devtool: 'source-map',
|
2016-05-11 16:16:32 +00:00
|
|
|
}
|
|
|
|
|
2017-04-17 20:24:00 +00:00
|
|
|
const mainConfig = merge({}, common.main, config)
|
2017-06-06 19:29:05 +00:00
|
|
|
const cliConfig = merge({}, common.cli, config)
|
2017-10-14 19:26:52 +00:00
|
|
|
const highlighterConfig = merge({}, common.highlighter, config)
|
2017-04-17 20:24:00 +00:00
|
|
|
|
|
|
|
const rendererConfig = merge({}, common.renderer, config, {
|
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
// This will cause the compiled CSS to be output to a
|
|
|
|
// styles.css and a <link rel="stylesheet"> tag to be
|
|
|
|
// appended to the index.html HEAD at compile time
|
|
|
|
{
|
|
|
|
test: /\.(scss|css)$/,
|
2018-05-04 06:20:04 +00:00
|
|
|
use: [MiniCssExtractPlugin.loader, 'css-loader', 'sass-loader'],
|
2017-04-17 20:24:00 +00:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
plugins: [
|
2018-05-04 06:20:04 +00:00
|
|
|
// Necessary to be able to use MiniCssExtractPlugin as a loader.
|
2018-05-23 05:42:47 +00:00
|
|
|
new MiniCssExtractPlugin({ filename: 'renderer.css' }),
|
2018-03-28 08:29:24 +00:00
|
|
|
new BundleAnalyzerPlugin({
|
|
|
|
// this generates the static HTML file to view afterwards, rather
|
|
|
|
// than disrupting the user
|
|
|
|
analyzerMode: 'static',
|
|
|
|
openAnalyzer: false,
|
|
|
|
// we can't emit this directly to the dist directory because the
|
|
|
|
// build script immediately blows away dist after webpack is done
|
|
|
|
// compiling the source into bundles
|
|
|
|
reportFilename: 'renderer.report.html',
|
|
|
|
}),
|
2017-07-13 15:15:34 +00:00
|
|
|
],
|
2016-06-17 18:48:49 +00:00
|
|
|
})
|
|
|
|
|
2017-05-22 07:59:38 +00:00
|
|
|
const crashConfig = merge({}, common.crash, config, {
|
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
// This will cause the compiled CSS to be output to a
|
|
|
|
// styles.css and a <link rel="stylesheet"> tag to be
|
|
|
|
// appended to the index.html HEAD at compile time
|
|
|
|
{
|
|
|
|
test: /\.(scss|css)$/,
|
2018-05-04 06:20:04 +00:00
|
|
|
use: [MiniCssExtractPlugin.loader, 'css-loader', 'sass-loader'],
|
2017-05-22 07:59:38 +00:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
plugins: [
|
2018-05-04 06:20:04 +00:00
|
|
|
// Necessary to be able to use MiniCssExtractPlugin as a loader.
|
2018-05-23 05:42:47 +00:00
|
|
|
new MiniCssExtractPlugin({ filename: 'crash.css' }),
|
2017-07-13 15:15:34 +00:00
|
|
|
],
|
2017-05-22 07:59:38 +00:00
|
|
|
})
|
|
|
|
|
2020-07-10 19:22:20 +00:00
|
|
|
// eslint-disable-next-line no-restricted-syntax
|
|
|
|
export default [
|
2017-07-13 15:15:34 +00:00
|
|
|
mainConfig,
|
|
|
|
rendererConfig,
|
|
|
|
crashConfig,
|
2017-07-13 19:46:45 +00:00
|
|
|
cliConfig,
|
2017-10-14 19:26:52 +00:00
|
|
|
highlighterConfig,
|
2017-07-13 15:15:34 +00:00
|
|
|
]
|