1
- const webpack = require ( " webpack" ) ;
2
- const path = require ( " path" ) ;
3
- const HtmlWebpackPlugin = require ( " html-webpack-plugin" ) ;
4
- const DashboardPlugin = require ( " webpack-dashboard/plugin" ) ;
5
- const nodeEnv = process . env . NODE_ENV || " development" ;
6
- const isProd = nodeEnv === " production" ;
1
+ const webpack = require ( ' webpack' )
2
+ const path = require ( ' path' )
3
+ const HtmlWebpackPlugin = require ( ' html-webpack-plugin' )
4
+ const DashboardPlugin = require ( ' webpack-dashboard/plugin' )
5
+ const nodeEnv = process . env . NODE_ENV || ' development'
6
+ const isProd = nodeEnv === ' production'
7
7
8
8
var config = {
9
- devtool : isProd ? " hidden-source-map" : " source-map" ,
10
- context : path . resolve ( " ./src" ) ,
9
+ devtool : isProd ? ' hidden-source-map' : ' source-map' ,
10
+ context : path . resolve ( ' ./src' ) ,
11
11
entry : {
12
- app : " ./index.ts" ,
13
- vendor : " ./vendor.ts"
12
+ app : ' ./index.ts' ,
13
+ vendor : ' ./vendor.ts'
14
14
} ,
15
15
output : {
16
- path : path . resolve ( " ./dist" ) ,
17
- filename : " [name].bundle.js" ,
18
- sourceMapFilename : " [name].bundle.map" ,
19
- devtoolModuleFilenameTemplate : function ( info ) {
20
- return " file:///" + info . absoluteResourcePath ;
16
+ path : path . resolve ( ' ./dist' ) ,
17
+ filename : ' [name].bundle.js' ,
18
+ sourceMapFilename : ' [name].bundle.map' ,
19
+ devtoolModuleFilenameTemplate : function ( info ) {
20
+ return ' file:///' + info . absoluteResourcePath
21
21
}
22
22
} ,
23
23
module : {
24
24
rules : [
25
25
{
26
- enforce : " pre" ,
26
+ enforce : ' pre' ,
27
27
test : / \. t s ? $ / ,
28
- exclude : [ " node_modules" ] ,
29
- use : [ " awesome-typescript-loader" , " source-map-loader" ]
28
+ exclude : [ ' node_modules' ] ,
29
+ use : [ ' awesome-typescript-loader' , ' source-map-loader' ]
30
30
} ,
31
- { test : / \. h t m l $ / , loader : "html-loader" } ,
32
- { test : / \. c s s $ / , loaders : [ "style-loader" , "css-loader" ] }
31
+ {
32
+ test : / \. ( j s | t s ) $ / ,
33
+ loader : 'istanbul-instrumenter-loader' ,
34
+ exclude : [ / \/ n o d e _ m o d u l e s \/ / ] ,
35
+ query : {
36
+ esModules : true
37
+ }
38
+ } ,
39
+ { test : / \. h t m l $ / , loader : 'html-loader' } ,
40
+ { test : / \. c s s $ / , loaders : [ 'style-loader' , 'css-loader' ] }
33
41
]
34
42
} ,
35
43
resolve : {
36
- extensions : [ " .ts" , " .js" ]
44
+ extensions : [ ' .ts' , ' .js' ]
37
45
} ,
38
46
plugins : [
39
47
new webpack . DefinePlugin ( {
40
- " process.env" : {
48
+ ' process.env' : {
41
49
// eslint-disable-line quote-props
42
50
NODE_ENV : JSON . stringify ( nodeEnv )
43
51
}
44
52
} ) ,
45
53
new HtmlWebpackPlugin ( {
46
- title : " Typescript Webpack Starter" ,
47
- template : " !!ejs-loader!src/index.html"
54
+ title : ' Typescript Webpack Starter' ,
55
+ template : ' !!ejs-loader!src/index.html'
48
56
} ) ,
49
57
new webpack . optimize . CommonsChunkPlugin ( {
50
- name : " vendor" ,
58
+ name : ' vendor' ,
51
59
minChunks : Infinity ,
52
- filename : " vendor.bundle.js"
60
+ filename : ' vendor.bundle.js'
53
61
} ) ,
54
62
new webpack . optimize . UglifyJsPlugin ( {
55
63
compress : { warnings : false } ,
@@ -67,11 +75,11 @@ var config = {
67
75
} )
68
76
] ,
69
77
devServer : {
70
- contentBase : path . join ( __dirname , " dist/" ) ,
78
+ contentBase : path . join ( __dirname , ' dist/' ) ,
71
79
compress : true ,
72
80
port : 3000 ,
73
81
hot : true
74
82
}
75
- } ;
83
+ }
76
84
77
- module . exports = config ;
85
+ module . exports = config
0 commit comments