javascript - Can't get webpack hot middleware working with react/redux -
im pulling out hairs trying hot reloading working. project loads when run node server.js
files not being hot reloaded.
server.js
// webpack stuff var webpack = require("webpack"); var webpackdevmiddleware = require("webpack-dev-middleware"); var webpackhotmiddleware = require("webpack-hot-middleware"); var config = require("./webpack.config"); var compiler = webpack(config); // email template var emailtemplate = require("./emailtemplate"); // express var express = require("express"); var app = express(); var crypto = require("crypto"); var bodyparser = require("body-parser"); var cookieparser = require("cookie-parser"); var port = 8000; app.use(webpackdevmiddleware(compiler, { noinfo: true, publicpath: config.output.publicpath })); app.use(webpackhotmiddleware(compiler)); app.use(express.static(__dirname + "/src")); app.use(bodyparser.urlencoded({ extended: false })); app.use(bodyparser.json()); app.use(cookieparser()); ....... shorten security
webpack.config.js
var webpack = require('webpack'); module.exports = { entry: [ 'webpack/hot/dev-server', 'webpack-hot-middleware/client', './src/index.js' ], output: { path: __dirname + '/src/build', filename: 'bundle.js', public: '/', publicpath: 'http://localhost:8000/public/' }, module: { loaders: [ { test: /\.jsx?$/, loaders: ['babel'], exclude: /node_modules/, include: __dirname + '/src' }, { test: /\.json$/, loader: 'json-loader' }, { test: /\.css$/, loader: 'style-loader!css-loader!postcss-loader' }, { test: /\.(png|jpg|jpeg|gif|woff)$/, loader: 'url-loader?limit=8192' } ] }, jest: { modulefileextensions: ["js", "jsx"] }, plugins: [ new webpack.optimize.occurenceorderplugin(), new webpack.hotmodulereplacementplugin(), new webpack.noerrorsplugin() ] };
please let me know if there other files useful see.
Comments
Post a Comment