@@ -2,59 +2,87 @@ const isProd = process.argv.indexOf('-p') >= 0;
2
2
const path = require ( 'path' ) ;
3
3
const { CleanWebpackPlugin } = require ( 'clean-webpack-plugin' )
4
4
const { VueLoaderPlugin } = require ( 'vue-loader' )
5
+ const ExtractTextPlugin = require ( 'extract-text-webpack-plugin' )
5
6
const HtmlWebpackPlugin = require ( 'html-webpack-plugin' )
6
7
7
- module . exports = {
8
- node : {
9
- fs : 'empty' , net : 'empty' , tls : 'empty' ,
10
- child_process : 'empty' , dns : 'empty' ,
11
- global : true , __dirname : true
8
+ module . exports = [
9
+ {
10
+ target : "node" ,
11
+ node : {
12
+ fs : 'empty' , net : 'empty' , tls : 'empty' ,
13
+ child_process : 'empty' , dns : 'empty' ,
14
+ global : true , __dirname : true
15
+ } ,
16
+ entry : [ './src/extension.ts' ] ,
17
+ output : {
18
+ path : path . resolve ( __dirname , 'out' ) ,
19
+ filename : 'extension.js' ,
20
+ libraryTarget : 'commonjs2'
21
+ } ,
22
+ externals : {
23
+ vscode : 'commonjs vscode'
24
+ } ,
25
+ resolve : {
26
+ extensions : [ '.ts' , '.js' ]
27
+ } ,
28
+ module : { rules : [ { test : / \. t s $ / , exclude : / n o d e _ m o d u l e s / , use : [ 'ts-loader' ] } ] } ,
29
+ watch : ! isProd ,
30
+ optimization : {
31
+ minimize : false
32
+ } ,
33
+ mode : isProd ? 'production' : 'development' ,
34
+ devtool : isProd ? false : 'source-map' ,
12
35
} ,
13
- entry : {
14
- extension : './src/extension.ts' ,
15
- query : './src/vue/pages/result/main.js'
16
- } ,
17
- output : {
18
- path : path . resolve ( __dirname , 'out' ) ,
19
- filename : '[name].js' ,
20
- devtoolModuleFilenameTemplate : '../[resource-path]'
21
- } ,
22
- externals : {
23
- vscode : 'commonjs vscode'
24
- } ,
25
- resolve : {
26
- extensions : [ '.ts' , '.vue' , '.js' ] ,
27
- alias : {
28
- 'vue$' : 'vue/dist/vue.esm.js' ,
29
- '@' : path . resolve ( 'src' ) ,
30
- }
31
- } ,
32
- module : {
33
- rules : [
34
- { test : / \. v u e $ / , loader : 'vue-loader' , options : { loaders : { css : [ "vue-style-loader" , "css-loader" ] , optimizeSSR : false } } } ,
35
- { test : / \. t s $ / , exclude : / n o d e _ m o d u l e s / , use : [ 'ts-loader' ] } ,
36
- { test : / \. c s s $ / , use : [ "vue-style-loader" , 'css-loader' ] } ,
37
- {
38
- test : / \. ( w o f f 2 ? | e o t | t t f | o t f ) ( \? .* ) ? $ / ,
39
- loader : 'url-loader' ,
40
- options : {
41
- limit : 10000
42
- }
36
+ {
37
+ entry : {
38
+ query : './src/vue/pages/result/main.js'
39
+ } ,
40
+ output : {
41
+ path : path . resolve ( __dirname , 'out' ) ,
42
+ filename : '[name].js'
43
+ } ,
44
+ resolve : {
45
+ extensions : [ '.vue' , '.js' ] ,
46
+ alias : {
47
+ 'vue$' : 'vue/dist/vue.esm.js' ,
48
+ '@' : path . resolve ( 'src' ) ,
43
49
}
44
- ]
45
- } ,
46
- plugins : [
47
- new VueLoaderPlugin ( ) ,
48
- new HtmlWebpackPlugin ( {
49
- filename : '../resources/webview/pages/result/index.html' , template : './src/vue/pages/result/index.html' ,
50
- chunks : [ 'query' ] , inject : true
51
- } ) ,
52
- new CleanWebpackPlugin ( { cleanStaleWebpackAssets : false } )
53
- ] ,
54
- watch : ! isProd ,
55
- optimization : {
56
- minimize : isProd
57
- } ,
58
- mode : isProd ? 'production' : 'development' ,
59
- devtool : isProd ? false : 'source-map' ,
60
- } ;
50
+ } ,
51
+ module : {
52
+ rules : [
53
+ // {
54
+ // test: /index\.css$/, use: ExtractTextPlugin.extract({
55
+ // fallback: "vue-style-loader",
56
+ // use: "css-loader"
57
+ // })
58
+ // },
59
+ { test : / \. v u e $ / , loader : 'vue-loader' , options : { loaders : { css : [ "vue-style-loader" , "css-loader" ] } } } ,
60
+ {
61
+ test : / \. c s s $ / , use : [ "vue-style-loader" , "css-loader" ]
62
+ } ,
63
+ {
64
+ test : / \. ( w o f f 2 ? | e o t | t t f | o t f ) ( \? .* ) ? $ / ,
65
+ loader : 'url-loader' ,
66
+ options : {
67
+ limit : 80000
68
+ }
69
+ }
70
+ ]
71
+ } ,
72
+ plugins : [
73
+ new ExtractTextPlugin ( "styles.css" ) ,
74
+ new VueLoaderPlugin ( ) ,
75
+ new HtmlWebpackPlugin ( {
76
+ filename : '../resources/webview/pages/result/index.html' , template : './src/vue/pages/result/index.html' ,
77
+ chunks : [ 'query' ] , inject : true
78
+ } ) ,
79
+ new CleanWebpackPlugin ( { cleanStaleWebpackAssets : false } )
80
+ ] ,
81
+ watch : ! isProd ,
82
+ optimization : {
83
+ minimize : false
84
+ } ,
85
+ mode : isProd ? 'production' : 'development' ,
86
+ devtool : isProd ? false : 'source-map' ,
87
+ }
88
+ ] ;
0 commit comments