Browse Source

Fixed react hot reload plus a few other things

update-deps
Alex Mikhalev 8 years ago
parent
commit
9cc2824298
  1. 4
      app/script/mqtt.ts
  2. 11
      webpack.config.js

4
app/script/mqtt.ts

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

11
webpack.config.js

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