0

I've successfully generated the production files and run from the node prod server (built into react-boilerplate). When I run the project from the IIS-configured URL, http://localhost/abc/, I get console errors: GET http://localhost/main.21e300b8d1fb516da3f2.js and GET http://localhost/main.7298ab25765cc3b7f65141e9b8a880ff.css

The path appears to be pointing to the root of localhost and doesn't seem to include "/abc".

I've set up my webpack config like so:

module.exports = (options) => ({
    entry: options.entry,
    output: Object.assign({
      path: path.resolve(process.cwd()),
      publicPath: '/',
    }, options.output),...

Is there a setting in my Webpack config I'm missing? Thanks for any help.

devly
  • 35
  • 1
  • 6

1 Answers1

0

It sounds like you've set up your site in IIS as a virtual directory within the IIS site pointing to localhost. The issue here is that any references to / in your site will translate to the root of your site, not the virtual directory.

Option 1 is to have Default Website point to your applicaiton (instead of the virtual directory). Option 2 is to create a whole new site in IIS and bind it to another port (or port 80 with a host header and a HOSTS entry).

Looking at your config, what happens if you set publicPath to /abc instead of /?

Babak Naffas
  • 12,395
  • 3
  • 34
  • 49
  • Creating a whole new site in IIS did the trick. I also had to change react-router's "browserHistory" to "hashHistory." When I changed to /abc in Webpack and/or the routes, it wasn't loading the app or any child routes. Thank you so much and happy new year! – devly Jan 03 '17 at 18:14