@@ -16,12 +16,21 @@ const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin')
16
16
const VueLoaderPlugin = require ( 'vue-loader/lib/plugin' )
17
17
const CopyWebpackPlugin = require ( 'copy-webpack-plugin' )
18
18
19
+ function inlineOptions ( loaders ) {
20
+ return loaders . map ( ( { loader, options= { } } ) => {
21
+ if ( ! isString ( loader ) ) throw new Error ( 'inlineOptions: loader should be a string!' )
22
+ if ( ! isObjectLike ( options ) ) throw new Error ( 'inlineOptions: options should be an object!' )
23
+ return loader + '?' + JSON . stringify ( options )
24
+ } )
25
+ }
26
+
19
27
function returnLess ( ) {
20
28
return [
21
29
process . env . NODE_ENV !== 'production'
22
30
? 'vue-style-loader'
23
31
: MiniCssExtractPlugin . loader ,
24
- 'css-loader' ,
32
+ // https://blog.csdn.net/vv_bug/article/details/108148263
33
+ 'css-loader?{"esModule":false}' ,
25
34
'less-loader'
26
35
]
27
36
}
@@ -30,7 +39,8 @@ function returnCss() {
30
39
process . env . NODE_ENV !== 'production'
31
40
? 'vue-style-loader'
32
41
: MiniCssExtractPlugin . loader ,
33
- 'css-loader'
42
+ // https://blog.csdn.net/vv_bug/article/details/108148263
43
+ 'css-loader?{"esModule":false}'
34
44
]
35
45
}
36
46
@@ -45,7 +55,7 @@ let whiteListedModules = ['vue']
45
55
46
56
let mainBrowserWindowConfig = {
47
57
name : 'main-browser-window' ,
48
- devtool : '# cheap-module-eval -source-map' ,
58
+ devtool : 'cheap-module-source-map' ,
49
59
entry : {
50
60
'main-browser-window' : path . join ( __dirname , '../src/renderer/mainBrowserWindow/main.ts' )
51
61
} ,
@@ -211,11 +221,19 @@ let mainBrowserWindowConfig = {
211
221
manifest : require ( '../static/vendor-manifest.json' )
212
222
} ) ,
213
223
new ForkTsCheckerWebpackPlugin ( {
214
- checkSyntacticErrors : true ,
215
- eslint : true ,
216
- tsconfig : path . join ( __dirname , '../src/tsconfig.json' ) ,
217
- tslintAutoFix : false ,
218
- vue : true
224
+ eslint : {
225
+ files : './src/**/*.{js,ts,vue}'
226
+ } ,
227
+ typescript : {
228
+ configFile : path . join ( __dirname , '../src/tsconfig.json' ) ,
229
+ diagnosticOptions : {
230
+ semantic : true ,
231
+ syntactic : true
232
+ } ,
233
+ extensions : {
234
+ vue : true
235
+ }
236
+ }
219
237
} ) ,
220
238
new ForkTsCheckerNotifierWebpackPlugin ( { title : 'Renderer Process [mainBrowserWindow]' , excludeWarnings : false } ) ,
221
239
new VueLoaderPlugin ( ) ,
@@ -248,7 +266,7 @@ let mainBrowserWindowConfig = {
248
266
249
267
let preloadsConfig = {
250
268
name : 'preloads' ,
251
- devtool : '# cheap-module-eval -source-map' ,
269
+ devtool : 'cheap-module-source-map' ,
252
270
entry : {
253
271
'webview-preload' : path . join ( __dirname , '../src/preloads/webview-preload.ts' ) ,
254
272
'extension-preload' : path . join ( __dirname , '../src/preloads/extension-preload.ts' ) ,
@@ -303,11 +321,19 @@ let preloadsConfig = {
303
321
test : / - p r e l o a d \. j s $ /
304
322
} ) ,
305
323
new ForkTsCheckerWebpackPlugin ( {
306
- checkSyntacticErrors : true ,
307
- eslint : true ,
308
- tsconfig : path . join ( __dirname , '../src/tsconfig.json' ) ,
309
- tslintAutoFix : false ,
310
- vue : true
324
+ eslint : {
325
+ files : './src/**/*.{js,ts,vue}'
326
+ } ,
327
+ typescript : {
328
+ configFile : path . join ( __dirname , '../src/tsconfig.json' ) ,
329
+ diagnosticOptions : {
330
+ semantic : true ,
331
+ syntactic : true
332
+ } ,
333
+ extensions : {
334
+ vue : true
335
+ }
336
+ }
311
337
} ) ,
312
338
new ForkTsCheckerNotifierWebpackPlugin ( { title : 'Renderer Process [preloads]' , excludeWarnings : false } )
313
339
] ,
@@ -330,7 +356,7 @@ let preloadsConfig = {
330
356
331
357
let preferenceViewConfig = {
332
358
name : 'preference-view' ,
333
- devtool : '# cheap-module-eval -source-map' ,
359
+ devtool : 'cheap-module-source-map' ,
334
360
entry : {
335
361
'preference-view' : path . join ( __dirname , '../src/renderer/preferenceView/main.ts' )
336
362
} ,
@@ -474,10 +500,19 @@ let preferenceViewConfig = {
474
500
manifest : require ( '../static/vendor-manifest.json' )
475
501
} ) ,
476
502
new ForkTsCheckerWebpackPlugin ( {
477
- checkSyntacticErrors : true ,
478
- eslint : true ,
479
- tsconfig : path . join ( __dirname , '../src/tsconfig.json' ) ,
480
- vue : true
503
+ eslint : {
504
+ files : './src/**/*.{js,ts,vue}'
505
+ } ,
506
+ typescript : {
507
+ configFile : path . join ( __dirname , '../src/tsconfig.json' ) ,
508
+ diagnosticOptions : {
509
+ semantic : true ,
510
+ syntactic : true
511
+ } ,
512
+ extensions : {
513
+ vue : true
514
+ }
515
+ }
481
516
} ) ,
482
517
new ForkTsCheckerNotifierWebpackPlugin ( { title : 'Renderer Process [preferenceView]' , excludeWarnings : false } ) ,
483
518
new VueLoaderPlugin ( )
@@ -502,7 +537,7 @@ let preferenceViewConfig = {
502
537
503
538
let playbooksViewConfig = {
504
539
name : 'playbooks-view' ,
505
- devtool : '# cheap-module-eval -source-map' ,
540
+ devtool : 'cheap-module-source-map' ,
506
541
entry : {
507
542
'playbooks-view' : path . join ( __dirname , '../src/renderer/playbooksView/main.ts' )
508
543
} ,
@@ -647,10 +682,19 @@ let playbooksViewConfig = {
647
682
manifest : require ( '../static/vendor-manifest.json' )
648
683
} ) ,
649
684
new ForkTsCheckerWebpackPlugin ( {
650
- checkSyntacticErrors : true ,
651
- eslint : true ,
652
- tsconfig : path . join ( __dirname , '../src/tsconfig.json' ) ,
653
- vue : true
685
+ eslint : {
686
+ files : './src/**/*.{js,ts,vue}'
687
+ } ,
688
+ typescript : {
689
+ configFile : path . join ( __dirname , '../src/tsconfig.json' ) ,
690
+ diagnosticOptions : {
691
+ semantic : true ,
692
+ syntactic : true
693
+ } ,
694
+ extensions : {
695
+ vue : true
696
+ }
697
+ }
654
698
} ) ,
655
699
new ForkTsCheckerNotifierWebpackPlugin ( { title : 'Renderer Process [playbooksView]' , excludeWarnings : false } ) ,
656
700
new VueLoaderPlugin ( )
@@ -675,7 +719,7 @@ let playbooksViewConfig = {
675
719
676
720
let commandPaletteConfig = {
677
721
name : 'command-palette' ,
678
- devtool : '# cheap-module-eval -source-map' ,
722
+ devtool : 'cheap-module-source-map' ,
679
723
entry : {
680
724
'command-palette' : path . join ( __dirname , '../src/renderer/commandPalette/main.ts' )
681
725
} ,
@@ -822,10 +866,19 @@ let commandPaletteConfig = {
822
866
manifest : require ( '../static/vendor-manifest.json' )
823
867
} ) ,
824
868
new ForkTsCheckerWebpackPlugin ( {
825
- checkSyntacticErrors : true ,
826
- eslint : true ,
827
- tsconfig : path . join ( __dirname , '../src/tsconfig.json' ) ,
828
- vue : true
869
+ eslint : {
870
+ files : './src/**/*.{js,ts,vue}'
871
+ } ,
872
+ typescript : {
873
+ configFile : path . join ( __dirname , '../src/tsconfig.json' ) ,
874
+ diagnosticOptions : {
875
+ semantic : true ,
876
+ syntactic : true
877
+ } ,
878
+ extensions : {
879
+ vue : true
880
+ }
881
+ }
829
882
} ) ,
830
883
new ForkTsCheckerNotifierWebpackPlugin ( { title : 'Renderer Process [commandPalette]' , excludeWarnings : false } ) ,
831
884
new VueLoaderPlugin ( )
@@ -851,7 +904,7 @@ let commandPaletteConfig = {
851
904
852
905
let workerConfig = {
853
906
name : 'worker' ,
854
- devtool : '# cheap-module-eval -source-map' ,
907
+ devtool : 'cheap-module-source-map' ,
855
908
entry : {
856
909
'search-worker' : path . join ( __dirname , '../src/renderer/mainBrowserWindow/js/search-worker.js' ) ,
857
910
'recommender' : path . join ( __dirname , '../src/renderer/commandPalette/js/recommender.js' ) ,
@@ -894,12 +947,6 @@ if (process.env.NODE_ENV === 'production') {
894
947
preferenceViewConfig . performance = { hints : false }
895
948
// Because the target is 'web'. Ref: https://github.com/webpack/webpack/issues/6715
896
949
playbooksViewConfig . performance = { hints : false }
897
- mainBrowserWindowConfig . devtool = false
898
- preloadsConfig . devtool = false
899
- preferenceViewConfig . devtool = false
900
- playbooksViewConfig . devtool = false
901
- commandPaletteConfig . devtool = false
902
- workerConfig . devtool = false
903
950
904
951
mainBrowserWindowConfig . plugins . push (
905
952
new webpack . LoaderOptionsPlugin ( {
0 commit comments