Skip to content

Commit 213b0d2

Browse files
committed
update
1 parent 013167d commit 213b0d2

File tree

6 files changed

+69
-16
lines changed

6 files changed

+69
-16
lines changed

tutorials/webpack-dev-server/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"description": "",
55
"main": "index.js",
66
"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"
89
},
910
"author": "",
1011
"license": "ISC",
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
log: function(msg){
3+
console.log(msg);
4+
// console.warn(msg);
5+
}
6+
};
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
body{
2-
color: blue;
2+
color: green;
33
}
Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
import "./index.css";
2+
import Logger from "./Logger";
23

34
var div = document.createElement("div");
45
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+
// }

tutorials/webpack-dev-server/webpack.config.js renamed to tutorials/webpack-dev-server/webpack.config1.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,19 @@ module.exports = {
2323
},
2424

2525
plugins: [
26-
new HtmlWebpackPlugin()
27-
// new webpack.HotModuleReplacementPlugin()
28-
]
26+
new HtmlWebpackPlugin(),
27+
new webpack.HotModuleReplacementPlugin()
28+
],
2929

3030
//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+
}
4141
};
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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: /\.js$/,
18+
loader: 'babel'
19+
}, {
20+
test: /\.css$/,
21+
loader: 'style!css'
22+
}]
23+
},
24+
25+
plugins: [
26+
new HtmlWebpackPlugin()
27+
]
28+
};

0 commit comments

Comments
 (0)