Skip to content
This repository has been archived by the owner on Apr 9, 2020. It is now read-only.

How to combin with an existing server #42

Closed
sotayamashita opened this issue Oct 21, 2015 · 5 comments
Closed

How to combin with an existing server #42

sotayamashita opened this issue Oct 21, 2015 · 5 comments

Comments

@sotayamashita
Copy link

I use Tomcat server and is there any way to combine them ?

@sotayamashita
Copy link
Author

babel-plugin-react-transform just compile js file to other server like webpack dev server ?
http://webpack.github.io/docs/webpack-dev-server.html#combining-with-an-existing-server

@joaovpmamede
Copy link

I'm having the same problem, well not exactly the same problem what happens is that I get a notification on console:

HMR] Checking for updates on the server...
(program):81 [React Transform HMR] Patching StatsWidget
(program):20 [HMR] Updated modules:
(program):22 [HMR]  - 787
(program):41 [HMR] App is up to date.

but then nothing happens (no "reload").
Everything was running smoothly with react-hot-loader though.

webpack config:

config.entry.unshift('webpack/hot/only-dev-server');
config.entry.unshift('webpack-dev-server/client?http://0.0.0.0:8081/');

config.devServer = {
  hot: true,
  inline: true
};

Fixed: I had an error on my code, but apparently the server still receives and notify the file changes.

Uncaught Error: Invariant Violation: addComponentAsRefTo(...): Only a ReactOwner can have refs. You might be adding a ref to a component that was not created inside a component's `render` method, or you have multiple copies of React loaded (details: https://fb.me/react-refs-must-have-owner).

@zhbhun
Copy link

zhbhun commented Nov 16, 2015

Backend server on locahost:8080, webpack-middle-server on localhost:3000, when changing code, hot-module-replace request address is http://localhost:8081/__webpack_hmr, is any config can change this?

@zhbhun
Copy link

zhbhun commented Nov 16, 2015

Oh! Config is in webpack-hot-middleware, not babel-plugin-react-transform. You need add path option to webpack-hot-middleware/client, like webpack-hot-middleware/client?path=http://localhost:3000/__webpack_hmr.

@gaearon
Copy link
Owner

gaearon commented Mar 5, 2016

Hi folks! Alas, this discussion is not relevant to this repo. Anything concerning the servers is best asked in Webpack or https://github.com/glenjamin/webpack-hot-middleware repos or chats. This repo is just for plugin that locates React components and wraps them—it’s not even related to hot reloading.

That said,

Fixed: I had an error on my code, but apparently the server still receives and notify the file changes.

Uncaught Error: Invariant Violation: addComponentAsRefTo(...): Only a ReactOwner can have refs. You might be adding a ref to a component that was not created inside a component's render method, or you have multiple copies of React loaded (details: https://fb.me/react-refs-must-have-owner).

I highlighted the relevant part: most likely you have multiple Reacts in the bundle. Check with npm ls react and remove the extra ones.

@gaearon gaearon closed this as completed Mar 5, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants