File tree Expand file tree Collapse file tree 6 files changed +69
-16
lines changed
tutorials/webpack-dev-server Expand file tree Collapse file tree 6 files changed +69
-16
lines changed Original file line number Diff line number Diff line change 4
4
"description" : " " ,
5
5
"main" : " index.js" ,
6
6
"scripts" : {
7
- "start" : " webpack-dev-server --content-base buildOutput --port=3344 --colors --inline --hot --open"
7
+ "start1" : " webpack-dev-server --config webpack.config1.js" ,
8
+ "start2" : " webpack-dev-server --config webpack.config2.js --content-base buildOutput --port=3344 --colors --inline --hot --open"
8
9
},
9
10
"author" : " " ,
10
11
"license" : " ISC" ,
Original file line number Diff line number Diff line change
1
+ module . exports = {
2
+ log : function ( msg ) {
3
+ console . log ( msg ) ;
4
+ // console.warn(msg);
5
+ }
6
+ } ;
Original file line number Diff line number Diff line change 1
1
body {
2
- color : blue ;
2
+ color : green ;
3
3
}
Original file line number Diff line number Diff line change 1
1
import "./index.css" ;
2
+ import Logger from "./Logger" ;
2
3
3
4
var div = document . createElement ( "div" ) ;
4
5
div . textContent = "Babel + Webpack + React + Redux" ;
5
- document . body . appendChild ( div ) ;
6
+ document . body . appendChild ( div ) ;
7
+
8
+ var timer = - 1 ;
9
+
10
+ function log ( TheLogger ) {
11
+ timer = setInterval ( function ( ) {
12
+ TheLogger . log ( new Date ( ) ) ;
13
+ } , 1000 ) ;
14
+ }
15
+
16
+ log ( Logger ) ;
17
+
18
+ // if(module.hot){
19
+ // module.hot.accept('Logger', () => {
20
+ // var NextLogger = require('/Logger');
21
+ // log(NextLogger);
22
+ // });
23
+ // }
Original file line number Diff line number Diff line change @@ -23,19 +23,19 @@ module.exports = {
23
23
} ,
24
24
25
25
plugins : [
26
- new HtmlWebpackPlugin ( )
27
- // new webpack.HotModuleReplacementPlugin()
28
- ]
26
+ new HtmlWebpackPlugin ( ) ,
27
+ new webpack . HotModuleReplacementPlugin ( )
28
+ ] ,
29
29
30
30
//webpack-dev-server --content-base buildOutput --port=3344 --colors --inline --hot --open
31
- // devServer: {
32
- // contentBase: './buildOutput',
33
- // port: '3344',
34
- // stats: {
35
- // colors: true
36
- // },
37
- // inline: true,
38
- // hot: true,
39
- // open: true
40
- // }
31
+ devServer : {
32
+ contentBase : './buildOutput' ,
33
+ port : '3344' ,
34
+ stats : {
35
+ colors : true
36
+ } ,
37
+ inline : true ,
38
+ hot : true ,
39
+ open : true
40
+ }
41
41
} ;
Original file line number Diff line number Diff line change
1
+ var path = require ( "path" ) ;
2
+
3
+ var webpack = require ( 'webpack' ) ;
4
+
5
+ var HtmlWebpackPlugin = require ( 'html-webpack-plugin' ) ;
6
+
7
+ module . exports = {
8
+ entry : path . join ( __dirname , "./src/index.js" ) ,
9
+
10
+ output : {
11
+ path : path . join ( __dirname , "buildOutput" ) ,
12
+ filename : "bundle.js"
13
+ } ,
14
+
15
+ module : {
16
+ loaders : [ {
17
+ test : / \. j s $ / ,
18
+ loader : 'babel'
19
+ } , {
20
+ test : / \. c s s $ / ,
21
+ loader : 'style!css'
22
+ } ]
23
+ } ,
24
+
25
+ plugins : [
26
+ new HtmlWebpackPlugin ( )
27
+ ]
28
+ } ;
You can’t perform that action at this time.
0 commit comments