reactjs - Unable to get Hot Module Replacement working on different port -
so working on .net mvc application portion of app portal client rendered using reactjs.
basically have index.cshtml file portal looks this:
<html lang="en"> <head> <title>user portal</title> </head> <body> <div id="app"></div> <script src="http://localhost:3000/bundle.js"></script> </body> </html>
and client side reactjs app running concurently on port:3000 using express server. access main mvc app through localhost:53079. wondering if possible hot module reloading work on port 53079 since how access application?
my webpack.config.dev.js looks this:
export default { debug: true, devtool: 'inline-source-map', noinfo: false, entry: [ 'eventsource-polyfill', // necessary hot reloading ie 'webpack-hot-middleware/client?reload=true', //note reloads page if hot module reloading fails. path.resolve(__dirname, 'src/index') ], target: 'web', output: { path: __dirname + '/dist', // note: physical files output production build task `npm run build`. publicpath: 'http://localhost:3000/', filename: 'bundle.js' }, devserver: { contentbase: path.resolve(__dirname, 'src') }, plugins: [ new webpack.hotmodulereplacementplugin(), new webpack.noerrorsplugin() ], module: { //..... } };
i have tried modifying port number in devserver, in output path without luck. i've been able find little reading on how configure hmr port numbers. console being littered following error message:
eventsource's response has mime type ("text/html") not "text/event-stream". aborting connection.
i figured out, need set options point @ hmr endpoint.
app.usewebpackdevmiddleware(new webpackdevmiddlewareoptions { hotmodulereplacement = true, hotmodulereplacementendpoint = "/dist/__webpack_hmr" });
Comments
Post a Comment