1- var path = require ( ' path' )
1+ var path = require ( " path" )
22
3- var webpack = require ( 'webpack' )
4- var ExtractTextPlugin = require ( 'extract-text-webpack-plugin' )
5- var deepExtend = require ( 'deep-extend' )
6- const { gitDescribeSync} = require ( 'git-describe' ) ;
3+ var webpack = require ( "webpack" )
4+ var ExtractTextPlugin = require ( "extract-text-webpack-plugin" )
5+ var deepExtend = require ( "deep-extend" )
6+ const { gitDescribeSync} = require ( "git-describe" )
7+ const os = require ( "os" )
78
8- var pkg = require ( ' ./package.json' )
9+ var pkg = require ( " ./package.json" )
910
1011let gitInfo
1112
1213try {
1314 gitInfo = gitDescribeSync ( __dirname )
1415} catch ( e ) {
1516 gitInfo = {
16- hash : ' noGit' ,
17+ hash : " noGit" ,
1718 dirty : false
1819 }
1920}
2021
2122var commonRules = [
2223 { test : / \. ( j s ( x ) ? ) ( \? .* ) ? $ / ,
2324 use : [ {
24- loader : ' babel-loader' ,
25+ loader : " babel-loader" ,
2526 options : {
2627 retainLines : true
2728 }
2829 } ] ,
29- include : [ path . join ( __dirname , ' src' ) ]
30+ include : [ path . join ( __dirname , " src" ) ]
3031 } ,
3132 { test : / \. ( t x t | y a m l ) ( \? .* ) ? $ / ,
32- loader : ' raw-loader' } ,
33+ loader : " raw-loader" } ,
3334 { test : / \. ( p n g | j p g | j p e g | g i f | s v g ) ( \? .* ) ? $ / ,
34- loader : ' url-loader?limit=10000' } ,
35+ loader : " url-loader?limit=10000" } ,
3536 { test : / \. ( w o f f | w o f f 2 ) ( \? .* ) ? $ / ,
36- loader : ' url-loader?limit=100000' } ,
37+ loader : " url-loader?limit=100000" } ,
3738 { test : / \. ( t t f | e o t ) ( \? .* ) ? $ / ,
38- loader : ' file-loader' }
39+ loader : " file-loader" }
3940]
4041
4142module . exports = function ( rules , options ) {
@@ -54,7 +55,7 @@ module.exports = function(rules, options) {
5455
5556 if ( specialOptions . separateStylesheets ) {
5657 plugins . push ( new ExtractTextPlugin ( {
57- filename : ' [name].css' + ( specialOptions . longTermCaching ? ' ?[contenthash]' : '' ) ,
58+ filename : " [name].css" + ( specialOptions . longTermCaching ? " ?[contenthash]" : "" ) ,
5859 allChunks : true
5960 } ) )
6061 }
@@ -78,61 +79,62 @@ module.exports = function(rules, options) {
7879
7980 plugins . push (
8081 new webpack . DefinePlugin ( {
81- 'process.env' : {
82- NODE_ENV : specialOptions . minimize ? JSON . stringify ( 'production' ) : null ,
83- WEBPACK_INLINE_STYLES : ! Boolean ( specialOptions . separateStylesheets )
84-
82+ "process.env" : {
83+ NODE_ENV : specialOptions . minimize ? JSON . stringify ( "production" ) : null ,
84+ WEBPACK_INLINE_STYLES : ! specialOptions . separateStylesheets
8585 } ,
86- ' buildInfo' : JSON . stringify ( {
86+ " buildInfo" : JSON . stringify ( {
8787 PACKAGE_VERSION : ( pkg . version ) ,
8888 GIT_COMMIT : gitInfo . hash ,
89- GIT_DIRTY : gitInfo . dirty
89+ GIT_DIRTY : gitInfo . dirty ,
90+ HOSTNAME : os . hostname ( ) ,
91+ BUILD_TIME : new Date ( ) . toUTCString ( )
9092 } )
9193 } ) )
9294
9395 delete options . _special
9496
95- var completeConfig = deepExtend ( {
97+ var completeConfig = deepExtend ( {
9698 entry : { } ,
9799
98100 output : {
99- path : path . join ( __dirname , ' dist' ) ,
100- publicPath : '/' ,
101- filename : ' [name].js' ,
102- chunkFilename : ' [name].js'
101+ path : path . join ( __dirname , " dist" ) ,
102+ publicPath : "/" ,
103+ filename : " [name].js" ,
104+ chunkFilename : " [name].js"
103105 } ,
104106
105- target : ' web' ,
107+ target : " web" ,
106108
107109 // yaml-js has a reference to `fs`, this is a workaround
108110 node : {
109- fs : ' empty'
111+ fs : " empty"
110112 } ,
111113
112114 module : {
113115 rules : commonRules . concat ( rules ) ,
114116 } ,
115117
116118 resolveLoader : {
117- modules : [ path . join ( __dirname , ' node_modules' ) ] ,
119+ modules : [ path . join ( __dirname , " node_modules" ) ] ,
118120 } ,
119121
120122 externals : {
121- ' buffertools' : true // json-react-schema/deeper depends on buffertools, which fails.
123+ " buffertools" : true // json-react-schema/deeper depends on buffertools, which fails.
122124 } ,
123125
124126 resolve : {
125127 modules : [
126- path . join ( __dirname , ' ./src' ) ,
127- ' node_modules'
128+ path . join ( __dirname , " ./src" ) ,
129+ " node_modules"
128130 ] ,
129131 extensions : [ ".web.js" , ".js" , ".jsx" , ".json" , ".less" ] ,
130132 alias : {
131133 base : "getbase/src/less/base" ,
132134 }
133135 } ,
134136
135- devtool : specialOptions . sourcemaps ? ' cheap-module-source-map' : null ,
137+ devtool : specialOptions . sourcemaps ? " cheap-module-source-map" : null ,
136138
137139 plugins,
138140
0 commit comments