Fixed react hot reload plus a few other things

This commit is contained in:
Alex Mikhalev 2017-05-03 18:52:55 -06:00
parent 2000e0126c
commit 9cc2824298
2 changed files with 6 additions and 9 deletions

View File

@ -1,5 +1,5 @@
import "paho-mqtt/mqttws31";
/// <reference path="./paho-mqtt.d.ts" />
import "paho-mqtt/mqttws31";
import MQTT = Paho.MQTT;
import { EventEmitter } from "events";
@ -15,7 +15,7 @@ export class MqttApiClient extends EventEmitter implements SprinklersApi {
constructor() {
super();
this.client = new Paho.MQTT.Client(location.hostname, 1884, MqttApiClient.newClientId());
this.client = new MQTT.Client(location.hostname, 1884, MqttApiClient.newClientId());
this.client.onMessageArrived = m => this.onMessageArrived(m);
this.client.onConnectionLost = e => this.onConnectionLost(e);
}

View File

@ -5,9 +5,11 @@ const HtmlWebpackPlugin = require("html-webpack-plugin");
module.exports = {
entry: [
"react-hot-loader/patch",
"webpack-dev-server/client?http://localhost:8080",
"webpack/hot/only-dev-server",
"./app/script/index.tsx"
],
devtool: "sourcemap",
devtool: "inline-source-map",
output: {
path: path.resolve(__dirname, "dist"),
filename: "bundle.js"
@ -32,12 +34,7 @@ module.exports = {
new webpack.NamedModulesPlugin(),
new webpack.HotModuleReplacementPlugin()
],
externals: {
"react": "React",
"react-dom": "ReactDOM"
},
devServer: {
hot: true,
contentBase: "./dist"
hot: true
}
};