11/* eslint-disable no-console */
2- import { DEV_SERVER_PORT , DEV_SERVER_HOSTNAME , DEV_SERVER_HOST_URL } from './config ' ;
2+ import { DEV_SERVER_PORT , DEV_SERVER_HOSTNAME , DEV_SERVER_HOST_URL } from './constants ' ;
33import WebpackDevServer from 'webpack-dev-server' ;
44import webpack from 'webpack' ;
55import baseConfig from './base' ;
@@ -13,33 +13,47 @@ const entry = [
1313
1414// Additional plugins
1515const plugins = [
16- new webpack . optimize . OccurenceOrderPlugin ( ) ,
1716 new webpack . HotModuleReplacementPlugin ( ) ,
18- new webpack . NoErrorsPlugin ( )
17+ new webpack . NoErrorsPlugin ( ) ,
18+ new webpack . NamedModulesPlugin ( )
1919] ;
2020
2121// Additional loaders
2222const loaders = [
2323 {
2424 test : / \. c s s $ / ,
25- loaders : [
26- 'style' ,
27- `css?modules&importLoaders=3&localIdentName=${ packageJson . config . css } ` ,
28- 'postcss' ,
29- ] ,
25+ use : [
26+ 'style-loader' ,
27+ {
28+ loader : 'css-loader' ,
29+ options : {
30+ modules : true ,
31+ importLoaders : 3 ,
32+ localIdentName : packageJson . config . css
33+ }
34+ } ,
35+ 'postcss-loader'
36+ ]
3037 } ,
3138 {
3239 test : / \. s c s s $ / ,
33- loaders : [
34- 'style' ,
35- `css?modules&importLoaders=3&localIdentName=${ packageJson . config . css } ` ,
36- 'postcss' ,
37- 'sass'
40+ use : [
41+ 'style-loader' ,
42+ {
43+ loader : 'css-loader' ,
44+ options : {
45+ modules : true ,
46+ importLoaders : 3 ,
47+ localIdentName : packageJson . config . css
48+ }
49+ } ,
50+ 'postcss-loader' ,
51+ 'sass-loader'
3852 ]
3953 } ,
4054 {
4155 test : / \. j s x $ | \. j s $ / ,
42- loader : 'babel' ,
56+ loader : 'babel-loader ' ,
4357 exclude : / n o d e _ m o d u l e s / ,
4458 // use react-transform to hot reload modules when hot is specified
4559 query : {
@@ -60,8 +74,6 @@ const loaders = [
6074] ;
6175
6276const config = Object . assign ( { } , baseConfig , {
63- eslint : { configFile : './.eslintrc' } ,
64- devServerPort : DEV_SERVER_PORT ,
6577 devtool : 'eval' ,
6678 entry : Object . assign ( { } , baseConfig . entry , {
6779 app : [
@@ -74,8 +86,8 @@ const config = Object.assign({}, baseConfig, {
7486 ...plugins
7587 ] ,
7688 module : Object . assign ( { } , baseConfig . module , {
77- loaders : [
78- ...baseConfig . module . loaders ,
89+ rules : [
90+ ...baseConfig . module . rules ,
7991 ...loaders
8092 ]
8193 } )
@@ -84,6 +96,7 @@ const config = Object.assign({}, baseConfig, {
8496console . info ( 'Firing up Webpack dev server...' ) ;
8597
8698new WebpackDevServer ( webpack ( config ) , {
99+ port : DEV_SERVER_PORT ,
87100 publicPath : config . output . publicPath ,
88101 hot : true ,
89102 historyApiFallback : true ,
@@ -101,6 +114,6 @@ new WebpackDevServer(webpack(config), {
101114 if ( err ) {
102115 console . error ( err ) ;
103116 } else {
104- console . info ( '🚧 Webpack client dev- server listening on ' + DEV_SERVER_HOST_URL + ' with publicPath:' + config . output . publicPath ) ;
117+ console . info ( ` Webpack dev server mounted at ${ DEV_SERVER_HOST_URL } . Asset path: ${ config . output . publicPath } ` ) ;
105118 }
106119} ) ;
0 commit comments