score:1

i had a similar issue when using a publicpath other than '', which i solved by adding a proxy entry to the devserver options:

devserver: {
  // ... rest of options
  proxy: {
    '/mypublicpath/*': {
      target: 'http://localhost:8080/',
      pathrewrite: { '^/mypublicpath': '' },
  }
}

other than that, make sure both output.publicpath and devserver.publicpath is set and equal.

hope this helps!

score:1

i had a similar issue. the dev server kept trying to load bundle.js from the directory relative to the url. my publicpath is '/', and, unfortunately, the other answer did not help. i solved the issue like this:

  devserver: {   
    // ... other options 
    historyapifallback: {
      rewrites: [
        { from: /^.*\/bundle\.js$/, to: '/bundle.js' },
      ]
    }
  }

Related Query

More Query from same tag