@@ -16,131 +16,132 @@ import checkNodeEnv from '../scripts/check-node-env';
16
16
import deleteSourceMaps from '../scripts/delete-source-maps' ;
17
17
18
18
checkNodeEnv ( 'production' ) ;
19
- deleteSourceMaps ( ) ;
19
+ // deleteSourceMaps();
20
20
21
21
const configuration : webpack . Configuration = {
22
- devtool : 'source-map' ,
22
+ devtool : 'source-map' ,
23
23
24
- mode : 'production' ,
24
+ mode : 'production' ,
25
25
26
- target : [ 'web' , 'electron-renderer' ] ,
26
+ target : [ 'web' , 'electron-renderer' ] ,
27
27
28
- entry : [ path . join ( webpackPaths . srcRendererPath , 'index.tsx' ) ] ,
28
+ entry : [ path . join ( webpackPaths . srcRendererPath , 'index.tsx' ) ] ,
29
29
30
- output : {
31
- path : webpackPaths . distRendererPath ,
32
- publicPath : './' ,
33
- filename : 'renderer.js' ,
34
- library : {
35
- type : 'umd' ,
30
+ output : {
31
+ path : webpackPaths . distRendererPath ,
32
+ publicPath : './' ,
33
+ filename : 'renderer.js' ,
34
+ library : {
35
+ type : 'umd' ,
36
+ } ,
36
37
} ,
37
- } ,
38
38
39
- module : {
40
- rules : [
41
- {
42
- test : / \. s ? ( a | c ) s s $ / ,
43
- use : [
44
- MiniCssExtractPlugin . loader ,
45
- {
46
- loader : 'css-loader' ,
47
- options : {
48
- modules : true ,
49
- sourceMap : true ,
50
- importLoaders : 1 ,
39
+ module : {
40
+ rules : [
41
+ {
42
+ test : / \. s ? ( a | c ) s s $ / ,
43
+ use : [
44
+ MiniCssExtractPlugin . loader ,
45
+ {
46
+ loader : 'css-loader' ,
47
+ options : {
48
+ modules : true ,
49
+ sourceMap : true ,
50
+ importLoaders : 1 ,
51
+ } ,
52
+ } ,
53
+ 'sass-loader' ,
54
+ ] ,
55
+ include : / \. m o d u l e \. s ? ( c | a ) s s $ / ,
51
56
} ,
52
- } ,
53
- 'sass-loader' ,
54
- ] ,
55
- include : / \. m o d u l e \. s ? ( c | a ) s s $ / ,
56
- } ,
57
- {
58
- test : / \. s ? ( a | c ) s s $ / ,
59
- use : [ MiniCssExtractPlugin . loader , 'css-loader' , 'sass-loader' ] ,
60
- exclude : / \. m o d u l e \. s ? ( c | a ) s s $ / ,
61
- } ,
62
- // Fonts
63
- {
64
- test : / \. ( w o f f | w o f f 2 | e o t | t t f | o t f ) $ / i,
65
- type : 'asset/resource' ,
66
- } ,
67
- // Images
68
- {
69
- test : / \. ( p n g | j p g | j p e g | g i f ) $ / i,
70
- type : 'asset/resource' ,
71
- } ,
72
- // SVG
73
- {
74
- test : / \. s v g $ / ,
75
- use : [
76
- {
77
- loader : '@svgr/webpack' ,
78
- options : {
79
- prettier : false ,
80
- svgo : false ,
81
- svgoConfig : {
82
- plugins : [ { removeViewBox : false } ] ,
83
- } ,
84
- titleProp : true ,
85
- ref : true ,
57
+ {
58
+ test : / \. s ? ( a | c ) s s $ / ,
59
+ use : [ MiniCssExtractPlugin . loader , 'css-loader' , 'sass-loader' ] ,
60
+ exclude : / \. m o d u l e \. s ? ( c | a ) s s $ / ,
61
+ } ,
62
+ // Fonts
63
+ {
64
+ test : / \. ( w o f f | w o f f 2 | e o t | t t f | o t f ) $ / i,
65
+ type : 'asset/resource' ,
66
+ } ,
67
+ // Images
68
+ {
69
+ test : / \. ( p n g | j p g | j p e g | g i f ) $ / i,
70
+ type : 'asset/resource' ,
71
+ } ,
72
+ // SVG
73
+ {
74
+ test : / \. s v g $ / ,
75
+ use : [
76
+ {
77
+ loader : '@svgr/webpack' ,
78
+ options : {
79
+ prettier : false ,
80
+ svgo : false ,
81
+ svgoConfig : {
82
+ plugins : [ { removeViewBox : false } ] ,
83
+ } ,
84
+ titleProp : true ,
85
+ ref : true ,
86
+ } ,
87
+ } ,
88
+ 'file-loader' ,
89
+ ] ,
86
90
} ,
87
- } ,
88
- 'file-loader' ,
89
91
] ,
90
- } ,
91
- ] ,
92
- } ,
92
+ } ,
93
93
94
- optimization : {
95
- minimize : true ,
96
- minimizer : [
97
- new TerserPlugin ( {
98
- parallel : true ,
99
- } ) ,
100
- new CssMinimizerPlugin ( ) ,
101
- ] ,
102
- } ,
94
+ optimization : {
95
+ minimize : true ,
96
+ minimizer : [
97
+ new TerserPlugin ( {
98
+ parallel : true ,
99
+ } ) ,
100
+ new CssMinimizerPlugin ( ) ,
101
+ ] ,
102
+ } ,
103
103
104
- plugins : [
105
- /**
106
- * Create global constants which can be configured at compile time.
107
- *
108
- * Useful for allowing different behaviour between development builds and
109
- * release builds
110
- *
111
- * NODE_ENV should be production so that modules do not perform certain
112
- * development checks
113
- */
114
- new webpack . EnvironmentPlugin ( {
115
- NODE_ENV : 'production' ,
116
- DEBUG_PROD : false ,
117
- } ) ,
104
+ plugins : [
105
+ /**
106
+ * Create global constants which can be configured at compile time.
107
+ *
108
+ * Useful for allowing different behaviour between development builds and
109
+ * release builds
110
+ *
111
+ * NODE_ENV should be production so that modules do not perform certain
112
+ * development checks
113
+ */
114
+ new webpack . EnvironmentPlugin ( {
115
+ NODE_ENV : 'production' ,
116
+ DEBUG_PROD : false ,
117
+ } ) ,
118
118
119
- new MiniCssExtractPlugin ( {
120
- filename : 'style.css' ,
121
- } ) ,
119
+ new MiniCssExtractPlugin ( {
120
+ filename : 'style.css' ,
121
+ } ) ,
122
122
123
- new BundleAnalyzerPlugin ( {
124
- analyzerMode : process . env . ANALYZE === 'true' ? 'server' : 'disabled' ,
125
- analyzerPort : 8889 ,
126
- } ) ,
123
+ new BundleAnalyzerPlugin ( {
124
+ analyzerMode :
125
+ process . env . ANALYZE === 'true' ? 'server' : 'disabled' ,
126
+ analyzerPort : 8889 ,
127
+ } ) ,
127
128
128
- new HtmlWebpackPlugin ( {
129
- filename : 'index.html' ,
130
- template : path . join ( webpackPaths . srcRendererPath , 'index.ejs' ) ,
131
- minify : {
132
- collapseWhitespace : true ,
133
- removeAttributeQuotes : true ,
134
- removeComments : true ,
135
- } ,
136
- isBrowser : false ,
137
- isDevelopment : process . env . NODE_ENV !== 'production' ,
138
- } ) ,
129
+ new HtmlWebpackPlugin ( {
130
+ filename : 'index.html' ,
131
+ template : path . join ( webpackPaths . srcRendererPath , 'index.ejs' ) ,
132
+ minify : {
133
+ collapseWhitespace : true ,
134
+ removeAttributeQuotes : true ,
135
+ removeComments : true ,
136
+ } ,
137
+ isBrowser : false ,
138
+ isDevelopment : process . env . NODE_ENV !== 'production' ,
139
+ } ) ,
139
140
140
- new webpack . DefinePlugin ( {
141
- 'process.type' : '"renderer"' ,
142
- } ) ,
143
- ] ,
141
+ new webpack . DefinePlugin ( {
142
+ 'process.type' : '"renderer"' ,
143
+ } ) ,
144
+ ] ,
144
145
} ;
145
146
146
147
export default merge ( baseConfig , configuration ) ;
0 commit comments