11'use strict' ;
22/*eslint-env node*/
3+ const _ = require ( 'lodash' ) ;
34var webpack = require ( 'webpack' ) ;
45var autoprefixer = require ( 'autoprefixer' ) ;
56var HtmlWebpackPlugin = require ( 'html-webpack-plugin' ) ;
@@ -84,7 +85,7 @@ module.exports = function makeWebpackConfig(options) {
8485 modulesDirectories : [
8586 'node_modules'
8687 ] ,
87- extensions : [ '' , ' .js', '.ts' ]
88+ extensions : [ '.js' , '.ts' ]
8889 } ;
8990 }
9091
@@ -110,22 +111,18 @@ module.exports = function makeWebpackConfig(options) {
110111
111112 // Initialize module
112113 config . module = {
113- noParse : [
114- path . join ( __dirname , 'node_modules' , 'zone.js' , 'dist' ) ,
115- path . join ( __dirname , 'node_modules' , '@angular' , 'bundles' ) ,
116- ] ,
117114 rules : [ {
118115 // JS LOADER
119116 // Reference: https://github.com/babel/babel-loader
120117 // Transpile .js files using babel-loader
121118 // Compiles ES6 and ES7 into ES5 code
122119 test : / \. j s $ / ,
123- use : {
124- loader : 'babel' ,
120+ use : [ {
121+ loader : 'babel-loader ' ,
125122 options : {
126123 plugins : TEST ? [ 'istanbul' ] : [ ] ,
127124 }
128- } ,
125+ } ] . concat ( DEV ? '@angularclass/hmr-loader' : [ ] ) ,
129126 include : [
130127 path . resolve ( __dirname , 'client/' ) ,
131128 path . resolve ( __dirname , 'server/config/environment/shared.js' ) ,
@@ -136,13 +133,13 @@ module.exports = function makeWebpackConfig(options) {
136133 // Reference: https://github.com/s-panferov/awesome-typescript-loader
137134 // Transpile .ts files using awesome-typescript-loader
138135 test : / \. t s $ / ,
139- use : {
136+ use : [ {
140137 loader : 'awesome-typescript-loader' ,
141138 < % _ if ( filters . ts ) { - % >
142139 options : {
143140 tsconfig : path . resolve ( __dirname , 'tsconfig.client.json' )
144141 } , < % } % >
145- } ,
142+ } ] . concat ( DEV ? '@angularclass/hmr-loader' : [ ] ) ,
146143 include : [
147144 path . resolve ( __dirname , 'client/' )
148145 ]
@@ -154,21 +151,21 @@ module.exports = function makeWebpackConfig(options) {
154151 // Pass along the updated reference to your code
155152 // You can add here any file extension you want to get copied to your output
156153 test : / \. ( p n g | j p g | j p e g | g i f | s v g | w o f f | w o f f 2 | t t f | e o t ) ( [ \? ] ? .* ) $ / ,
157- use : 'file'
154+ use : 'file-loader '
158155 } , {
159156 < % _ if ( filters . pug ) { _ % >
160157 // Pug HTML LOADER
161158 // Reference: https://github.com/willyelm/pug-html-loader
162159 // Allow loading Pug throw js
163160 test : / \. ( j a d e | p u g ) $ / ,
164- use : 'pug-html'
161+ use : 'pug-html-loader '
165162 } , { < % } % >
166163 < % _ if ( filters . html ) { _ % >
167164 // HTML LOADER
168165 // Reference: https://github.com/webpack/raw-loader
169166 // Allow loading html through js
170167 test : / \.html$ / ,
171- use : 'raw'
168+ use : 'raw-loader '
172169 } , { < % } % >
173170 // CSS LOADER
174171 // Reference: https://github.com/webpack/css-loader
@@ -183,16 +180,16 @@ module.exports = function makeWebpackConfig(options) {
183180 //
184181 // Reference: https://github.com/webpack/style-loader
185182 // Use style-loader in development for hot-loading
186- ? ExtractTextPlugin . extract ( 'style' , 'css?sourceMap! postcss' )
183+ ? ExtractTextPlugin . extract ( { fallbackLoader : 'style-loader ' , loader : [ 'css-loader' , ' postcss-loader' ] } )
187184 // Reference: https://github.com/webpack/null-loader
188185 // Skip loading css in test mode
189- : 'null'
186+ : 'null-loader '
190187 } < % if ( ! filters . css ) { % > , {
191188 < % _ if ( filters . sass ) { _ % >
192189 // SASS LOADER
193190 // Reference: https://github.com/jtangelder/sass-loader
194191 test : / \. ( s c s s | s a s s ) $ / ,
195- use : [ 'raw' , 'sass' ] ,
192+ use : [ 'raw-loader ' , 'sass-loader ' ] ,
196193 include : [
197194 path . resolve ( __dirname , 'node_modules/bootstrap-sass/assets/stylesheets/*.scss' ) ,
198195 path . resolve ( __dirname , 'client' )
@@ -201,7 +198,7 @@ module.exports = function makeWebpackConfig(options) {
201198 // LESS LOADER
202199 // Reference: https://github.com/
203200 test : / \.less$ / ,
204- use : [ 'style' , 'css' , 'less' ] ,
201+ use : [ 'style-loader ' , 'css-loader ' , 'less-loader ' ] ,
205202 include : [
206203 path . resolve ( __dirname , 'node_modules/bootstrap/less/*.less' ) ,
207204 path . resolve ( __dirname , 'client/app/app.less' )
@@ -210,7 +207,7 @@ module.exports = function makeWebpackConfig(options) {
210207 // Stylus LOADER
211208 // Reference: https://github.com/
212209 test : / \.styl$ / ,
213- use : [ 'style' , 'css' , 'stylus' ] ,
210+ use : [ 'style-loader ' , 'css-loader ' , 'stylus-loader ' ] ,
214211 include : [
215212 path . resolve ( __dirname , 'node_modules/bootstrap-styl/bootstrap/*.styl' ) ,
216213 path . resolve ( __dirname , 'client/app/app.styl' )
@@ -238,8 +235,9 @@ module.exports = function makeWebpackConfig(options) {
238235 // Reference: https://github.com/webpack/extract-text-webpack-plugin
239236 // Extract css files
240237 // Disabled when in test mode or not in build mode
241- new ExtractTextPlugin ( '[name].[hash].css' , {
242- disable : ! BUILD || TEST
238+ new ExtractTextPlugin ( {
239+ filename : '[name].[hash].css' ,
240+ disable : ! BUILD || TEST ,
243241 } ) ,
244242
245243 new webpack . LoaderOptionsPlugin ( {
@@ -366,21 +364,6 @@ module.exports = function makeWebpackConfig(options) {
366364 config . debug = false ;
367365 }
368366
369- /**
370- * Dev server configuration
371- * Reference: http://webpack.github.io/docs/configuration.html#devserver
372- * Reference: http://webpack.github.io/docs/webpack-dev-server.html
373- */
374- config . devServer = {
375- contentBase : './client/' ,
376- stats : {
377- modules : false ,
378- cached : false ,
379- colors : true ,
380- chunk : false
381- }
382- } ;
383-
384367 config . node = {
385368 global : true ,
386369 process : true ,
0 commit comments