Skip to content
This repository was archived by the owner on Sep 7, 2021. It is now read-only.

Commit 473ab86

Browse files
committed
Trying out React Hot Loader for the widgets page
1 parent 92e8955 commit 473ab86

10 files changed

Lines changed: 19252 additions & 5175 deletions

File tree

reactjs-adminlte/package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@
1515
"babel-core": "~6.5.1",
1616
"babel-loader": "~6.2.2",
1717
"babel-preset-es2015": "~6.5.0",
18-
"babel-preset-react": "~6.5.0"
18+
"babel-preset-react": "~6.5.0",
19+
"react": "~0.14.7"
20+
},
21+
"devDependencies": {
22+
"webpack-dev-server": "~1.14.1",
23+
"react-hot-loader": "~1.3.0"
1924
}
2025
}

reactjs-adminlte/public/dist/js/buttons.bundle.js

Lines changed: 64 additions & 29 deletions
Large diffs are not rendered by default.

reactjs-adminlte/public/dist/js/dashboardV1.bundle.js

Lines changed: 128 additions & 60 deletions
Large diffs are not rendered by default.

reactjs-adminlte/public/dist/js/generalUIElements.bundle.js

Lines changed: 88 additions & 60 deletions
Large diffs are not rendered by default.

reactjs-adminlte/public/dist/js/timeline.bundle.js

Lines changed: 108 additions & 75 deletions
Large diffs are not rendered by default.

reactjs-adminlte/public/dist/js/vendors.js

Lines changed: 18639 additions & 4832 deletions
Large diffs are not rendered by default.

reactjs-adminlte/public/dist/js/widgets.bundle.js

Lines changed: 180 additions & 113 deletions
Large diffs are not rendered by default.

reactjs-adminlte/server.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,29 @@ app.set('view engine', 'html');
1414
app.engine('html', consolidate.handlebars);
1515
app.use(express.static('./public')); //Set the folder from where you serve all static files like images, css, javascripts, libraries etc
1616
app.use(bodyParser.urlencoded({ extended: true }));
17-
var portNumber = 8080;
17+
var portNumber = 8000;
1818

1919
http.createServer(app).listen(portNumber, function(){
2020
console.log('Server listening at port '+ portNumber);
2121
routes.initialize(app);
2222
});
2323

24+
// var webpack = require('webpack');
25+
// var WebpackDevServer = require('webpack-dev-server');
26+
// var config = require('./webpack.config');
27+
28+
// new WebpackDevServer(webpack(config), {
29+
// publicPath: config.output.publicPath,
30+
// hot: true,
31+
// historyApiFallback: true
32+
// }).listen(3000, 'localhost', function (err, result) {
33+
// if (err) {
34+
// console.log(err);
35+
// }
36+
37+
// console.log('Listening at localhost:3000');
38+
// });
39+
2440
/*
2541
2642

reactjs-adminlte/views/widgets.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,14 @@
3939
<script src="/dist/js/vendors.js"></script>
4040
<script src="/dist/js/widgets.bundle.js"></script>
4141

42+
43+
<!--Use this only in development, while using React Hot Loader -->
44+
<!--
45+
<script src="http://localhost:8080/dist/js/vendors.js"></script>
46+
<script src="http://localhost:8080/dist/js/widgets.bundle.js"></script>
47+
-->
48+
49+
4250
<!--
4351
<script src="../plugins/jQuery/jQuery-2.1.4.min.js"></script>
4452
<script src="../bootstrap/js/bootstrap.min.js"></script>

reactjs-adminlte/webpack.config.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ var config = {
1414

1515
resolve: {
1616
alias: {
17-
react: lib_dir + '/react.js',
17+
react: node_dir + '/react',
1818
reactDom: lib_dir + '/react-dom',
1919
jquery: lib_dir + '/jQuery-2.1.4.min.js',
2020
velocity: lib_dir + '/velocity.min.js',
@@ -36,6 +36,7 @@ var config = {
3636
},
3737

3838
plugins: [
39+
//new webpack.HotModuleReplacementPlugin(),
3940
new webpack.ProvidePlugin({
4041
'$': "jquery",
4142
'jQuery': "jquery",
@@ -49,11 +50,11 @@ var config = {
4950

5051
entry: {
5152
dashboardV1: './public/src/dashboardV1/js/main',
52-
widgets: './public/src/widgets/js/main',
53+
widgets: ['./public/src/widgets/js/main'],
5354
timeline: './public/src/timeline-page/js/main',
5455
buttons: './public/src/buttons/js/main',
5556
generalUIElements: './public/src/ui-elements/general/js/main',
56-
vendors: ['react','reactDom','jquery','velocity','jqueryUi','bootstrap','moment','bootstrapDatepicker','slimscroll','fastclick']
57+
vendors: ['react','reactDom','jquery','velocity','jqueryUi','bootstrap','moment','bootstrapDatepicker','slimscroll','fastclick'],
5758
},
5859

5960
output: {
@@ -68,10 +69,16 @@ var config = {
6869
],
6970
loaders: [
7071
{
72+
test: /\.jsx?$/,
73+
loaders: ['react-hot'],
74+
include: path.join(__dirname, 'public')
75+
76+
},{
7177
loader: 'babel', //'jsx-loader'
7278
query: {
7379
presets: ['react', 'es2015']
74-
}
80+
},
81+
include: path.join(__dirname, 'public')
7582
},
7683
]
7784
}
@@ -84,6 +91,9 @@ module.exports = config;
8491
----------
8592
View package.json for more configuration details
8693
94+
0. During development:-
95+
Run webpack-dev-server --hot --inline and point your entry files to http://localhost:8080 in your HTML, for HMP
96+
8797
1. Command:-
8898
webpack --profile --json > stats.json
8999

0 commit comments

Comments
 (0)