Skip to content

Commit

Permalink
hot reloading working
Browse files Browse the repository at this point in the history
  • Loading branch information
Weyland Joyner committed Oct 17, 2015
1 parent 9d26a1a commit e5aa944
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
11 changes: 9 additions & 2 deletions config/http.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
* For more information on configuration, check out:
* http://sailsjs.org/#!/documentation/reference/sails.config/sails.config.http.html
*/
var express = require('express')
var express = require('express');
var webpack = require('webpack');
var config = require('../webpack.config');

module.exports.http = {

Expand Down Expand Up @@ -62,7 +64,12 @@ module.exports.http = {
// }

customMiddleware: function (app) {
app.use('/', express.static(process.cwd() + '/dist'));
var compiler = webpack(config);
app.use(require("webpack-dev-middleware")(compiler, {
noInfo: true, publicPath: config.output.publicPath
}));

app.use(require("webpack-hot-middleware")(compiler));
},


Expand Down
2 changes: 1 addition & 1 deletion src/js/colors.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export const NICE = 'red';
export const NICE = 'blue';
export const SUPER_NICE = 'darkred';
5 changes: 4 additions & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ var webpack = require('webpack');

module.exports = {
devtool: 'eval',
entry: './src/js/index',
entry: [
'webpack-hot-middleware/client',
'./src/js/index'
],
output: {
path: __dirname + '/.tmp/public/js',
filename: 'bundle.js'
Expand Down

0 comments on commit e5aa944

Please sign in to comment.