-
Notifications
You must be signed in to change notification settings - Fork 74
/
webpack.electron.ts
45 lines (39 loc) · 1.62 KB
/
webpack.electron.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/***********************************************************
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License
**********************************************************/
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin; // tslint:disable-line: no-var-requires
import * as webpack from 'webpack';
import { merge } from 'webpack-merge';
import common from './webpack.common';
const MiniCssExtractPlugin = require('mini-css-extract-plugin'); // tslint:disable-line: no-var-requires
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin'); // tslint:disable-line: no-var-requires
const config: webpack.Configuration = merge(common, {
mode: 'production',
module: {
rules: [
{
test: /.s?css$/,
use: [MiniCssExtractPlugin.loader, "css-loader", "sass-loader"],
}
]
},
optimization: {
minimizer: [new CssMinimizerPlugin({})]
},
plugins: [
// new BundleAnalyzerPlugin(),
new MiniCssExtractPlugin({
// // Options similar to the same options in webpackOptions.output
// // all options are optional
// chunkFilename: '[id].[hash].optimize.css',
// filename: '[name].[hash].optimize.css',
// ignoreOrder: false, // Enable to remove warnings about conflicting order
}),
new webpack.NormalModuleReplacementPlugin(
/(.*)appConfig.ENV(\.*)/,
resource => resource.request = resource.request.replace(/ENV/, 'electron')
)
]
});
export default config;