nwb icon indicating copy to clipboard operation
nwb copied to clipboard

Double configuration necessary to change HMR url

Open wanbinkimoon opened this issue 6 years ago • 1 comments

IMO this is confusing, while the docs suggest to edit the port forwarding in nwb.config.js this configuration will be overridden unless the same argument is specified in the command.

https://github.com/insin/nwb/blob/734537207b9024145c97c3a6c8a78366b311c705/src/createServerWebpackConfig.js#L26

To override the default configuration I had both to define a nwb.config.js

module.exports = {
  type: 'react-app', 
  devServer: {
    port: 3000,
    public: "localhost:3000",
    publicPath: "http://localhost:3000/", 
    disableHostCheck: true,
    open: false
  },
  webpack: {
    publicPath: "http://localhost:3000/", 
  }
}

and define the port in the command in package.json

{
...
scripts: {
  ...
  "start": "nwb serve-react-app --port 3000",
}

wanbinkimoon avatar Sep 21 '18 10:09 wanbinkimoon

This is similar to #524, as any args config will have been added to serverConfig by this point, so it should only be checking serverConfig at this point - I should be able to fix both at the same time.

insin avatar Mar 11 '19 03:03 insin