Giter Site home page Giter Site logo

Comments (11)

razh avatar razh commented on May 13, 2024

@vitalybe

You can specify it in the path for webpack-hot-middleware/client:

  entry: [
    'webpack-hot-middleware/client?path=http://localhost:3000/__webpack_hmr',
    './src/index'
  ],

'webpack-hot-middleware/client',

You may also need to set CORS headers on responses from devServer.js:

app.use(function(req, res, next) {
  res.header('Access-Control-Allow-Origin', '*');
  res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept');
  next();
});

from react-transform-boilerplate.

NeXTs avatar NeXTs commented on May 13, 2024

@razh 👍 big thanks
I stumbled upon same problem while trying to integrate with php project

from react-transform-boilerplate.

NeXTs avatar NeXTs commented on May 13, 2024

No, this didn't help :(
Specifying ?path=http://localhost:3000/__webpack_hmr DOES provide access to __webpack_hmr at custom port 3000

But after triggering first source change - server returns SINGLE response with content of my static html file, not JSON with list of updates as I might expect. (it does return correct JSON response in case using same port for both server and webpack-hot-middleware)

Remote Address:127.0.0.1:80
Request URL:http://localhost/static/12813d883d25bbe64a3f.hot-update.json
Request Method:GET
Status Code:200 OK

Response

<!doctype html>
<html>
  <head>
    <title>React Transform Boilerplate</title>
  </head>
  <body>
    <div id='root'>
    </div>
    <script src="http://localhost:3000/static/bundle.js"></script>
  </body>
</html>

Afterwards it ignores next update triggers and don't respond at all.
Does someone found workaround for this?

from react-transform-boilerplate.

NeXTs avatar NeXTs commented on May 13, 2024

Aha, okay.
http://localhost:3000/static/12813d883d25bbe64a3f.hot-update.json
returns correct JSON.

How to force webpack-hot-middleware to make call with 3000 port?

from react-transform-boilerplate.

gaearon avatar gaearon commented on May 13, 2024

You don't have to use Webpack Hot Middleware.
Just keep using Webpack Dev Server if that works for you. :-)

from react-transform-boilerplate.

NeXTs avatar NeXTs commented on May 13, 2024

I've never used Webpack Dev Server before but for curiosity tried it just a moment ago and experienced same behaviour.
Anyway finally I made it work by setting in webpack.config

{
  output: {
    ..
    publicPath: 'http://localhost:3000/static/'
  }
}

from react-transform-boilerplate.

gaearon avatar gaearon commented on May 13, 2024

I've never used Webpack Dev Server

What did you use with React Hot Loader?

from react-transform-boilerplate.

khanetor avatar khanetor commented on May 13, 2024

Out of curiosity, why do you prefer webpack-dev-middleware over webpack-dev-server?

from react-transform-boilerplate.

weblancaster avatar weblancaster commented on May 13, 2024

@nlhkh webpack-dev-middleware if you are using a dynamic server.. you'd want to add the middleware that way all connections to DB or API's and process work.. Using just webpack-dev-server would have to do a bunch of work around to achieve what you can achieve with webpack-dev-middleware out-of-the-box.

from react-transform-boilerplate.

JoshAddington avatar JoshAddington commented on May 13, 2024

The entry settings that @razh offered work for me in getting react-transform working with Django. 👍

from react-transform-boilerplate.

gaearon avatar gaearon commented on May 13, 2024

Closing as non-actionable.

from react-transform-boilerplate.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.