@@ -7,7 +7,8 @@ var webpack = require('webpack'),
77 ExtractTextPlugin = require ( 'extract-text-webpack-plugin' ) ,
88 BowerWebpackPlugin = require ( 'bower-webpack-plugin' ) ,
99 EntryGeneratorPlugin = require ( 'entry-generator-webpack-plugin' ) ,
10- OmitTildePlugin = require ( 'omit-tilde-webpack-plugin' ) ;
10+ OmitTildePlugin = require ( 'omit-tilde-webpack-plugin' ) ,
11+ Md5HashPlugin = require ( 'webpack-md5-hash' ) ;
1112
1213/**
1314 * Add configuration common to all modes.
@@ -83,17 +84,23 @@ function common(loaderRoot, options) {
8384 . loader ( 'image' , {
8485 test : / \. ( j p e ? g | p n g | g i f | s v g ) ( [ # ? ] .* ) ? $ / i,
8586 loaders : [
86- 'file?hash=sha512&digest=hex& name=[hash].[ext]' ,
87+ 'file?name=[md5: hash:hex:20 ].[ext]' ,
8788 'image-webpack?optimizationLevel=7&interlaced=false'
8889 ]
8990 } )
90- . loader ( 'woff' , {
91- test : / \. w o f f 2 ? ( [ # ? ] .* ) ? $ / i,
92- loader : 'url?limit=10000&mimetype=application/font-woff&name=[hash].[ext]'
91+ . loader ( 'icon' , {
92+ test : / \. i c o ( [ # ? ] .* ) ? $ / i,
93+ loaders : [
94+ 'file?name=[md5:hash:hex:20].[ext]'
95+ ]
9396 } )
9497 . loader ( 'font' , {
95- test : / \. ( e o t | t t f | i c o | o t f ) ( [ # ? ] .* ) ? $ / i,
96- loader : 'file?name=[hash].[ext]'
98+ test : / \. ( e o t | t t f | o t f ) ( [ # ? ] .* ) ? $ / i,
99+ loader : 'file?name=[md5:hash:hex:20].[ext]'
100+ } )
101+ . loader ( 'woff' , { // NB: I coppied this from somewhere, not sure why we would embed woff and not other fonts
102+ test : / \. w o f f 2 ? ( [ # ? ] .* ) ? $ / i,
103+ loader : 'url?limit=10000&mimetype=application/font-woff&name=[md5:hash:hex:20].[ext]'
97104 } )
98105 . loader ( 'js-bower' , {
99106 test : / \. j s $ / i,
@@ -108,11 +115,12 @@ function common(loaderRoot, options) {
108115 exclude : / [ \\ \/ ] ( b o w e r _ c o m p o n e n t s | w e b p a c k | c s s - l o a d e r ) [ \\ \/ ] / i,
109116 loaders : [
110117 'ng-annotate?sourceMap' ,
111- 'adjust-sourcemap?format=absolute' , // fix ng-annotate source maps in Windows but tweaking incoming map
118+ // fix ng-annotate source maps in Windows but using absolute paths in incoming source-map
119+ 'adjust-sourcemap?format=absolute' ,
112120 'nginject?sourceMap&deprecate&singleQuote' ,
113- 'babel?sourceMap&ignore=buffer&compact=false'
114121 // https://github.com/feross/buffer/issues/79
115122 // http://stackoverflow.com/a/29857361/5535360
123+ 'babel?sourceMap&ignore=buffer&compact=false'
116124 ]
117125 } )
118126 . loader ( 'html' , {
@@ -134,24 +142,26 @@ function common(loaderRoot, options) {
134142 deprecate : true
135143 } ] )
136144 . plugin ( 'bower' , BowerWebpackPlugin , [ {
137- includes : / \. ( ( j s | c s s ) | ( w o f f 2 ? | e o t | t t f | o t f ) ( [ # ? ] .* ) ? ) $ / i,
145+ includes : / \. ( ( j s | c s s ) | ( j p e ? g | p n g | g i f | s v g | i c o ) | ( w o f f 2 ? | e o t | t t f | o t f ) ( [ # ? ] .* ) ? ) $ / i,
138146 searchResolveModulesDirectories : false
139147 } ] )
140148
141149 // globals
142150 . plugin ( 'provide' , webpack . ProvidePlugin , [ options . globals ] )
143151
144152 // output, chunking, optimisation
153+ // https://github.com/webpack/webpack/issues/1315#issuecomment-139930039
145154 . plugin ( 'extract-text' , ExtractTextPlugin , [
146155 undefined ,
147- '[name].[contenthash].css' ,
156+ '[name].[md5: contenthash:hex:20 ].css' ,
148157 { allChunks : true }
149158 ] )
150159 . plugin ( 'commons' , webpack . optimize . CommonsChunkPlugin , [ {
151160 name : 'vendor' ,
152161 minChunks : Infinity
153162 } ] )
154- . plugin ( 'occurence-order' , webpack . optimize . OccurenceOrderPlugin ) ;
163+ . plugin ( 'occurence-order' , webpack . optimize . OccurenceOrderPlugin )
164+ . plugin ( 'md5-hash' , Md5HashPlugin ) ;
155165}
156166
157167module . exports = common ;
0 commit comments