react-redux-starter-kit icon indicating copy to clipboard operation
react-redux-starter-kit copied to clipboard

Path issue when deployed to production

Open MrStronger opened this issue 7 years ago • 0 comments

Hi,

I got a problem and I don't know where does the error come from,and seems nobody has the same issue so far:

I writed a 404 module like this:

 export default () => ({
  path: '404',
  getComponent (nextState, cb) {
    require.ensure([], (require) => {
      const PageNotFound = require('./components/PageNotFound').default
      cb(null, PageNotFound)
    })
  }
})

and I also writed an redirect.js like this:

export default {
  path: '*',
  indexRoute: {
    onEnter (nextState, replace) {
      replace('/404')
    }
  }
}

In the routes/index.js :

export const createRoutes = (store) => ({
  path: '/',
  component: CoreLayout,
  indexRoute: Home,
  childRoutes: [
    // ...
    PageNotFound(),
    Redirect
  ]
})

when I run yarn start it goes well and no errors ,but when I run yarn build and push ./dist to gh-pages and open the url,I got something wrong: Failed to load resource: the server responded with a status of 404 (Not Found) Error: Loading chunk 3 failed. at HTMLScriptElement.r (bootstrap 14aade6b3c5bc7f36bc8:103) Error: Loading chunk 3 failed. at HTMLScriptElement.r (bootstrap 14aade6b3c5bc7f36bc8:103) Am I wrong? where and how to solve?

MrStronger avatar Jun 13 '17 05:06 MrStronger