React routing, path not working, bundle not found

前端 未结 3 1640
再見小時候
再見小時候 2021-01-21 11:48

The following route works great and displays the AdministratePage component:

 

Howe

相关标签:
3条回答
  • 2021-01-21 12:30

    Another way of solving this problem is to add the following tag to your index.html page:

    <base href="/">
    
    0 讨论(0)
  • 2021-01-21 12:39

    Slash looks useless here

    filename: '/bundle.js'
    

    Also try to define publicPath

    output: {
      filename: 'bundle.js',
      path: path.resolve('dist'),
      publicPath: '/',
    },
    

    https://webpack.js.org/guides/public-path/

    0 讨论(0)
  • 2021-01-21 12:47

    React-router v4 now allows you to use regexes to match params

    <Route path="/admin/all | /admin" component={AdministratePage} />
    

    It uses path-to-regexp

    path-to-regexp

    0 讨论(0)
提交回复
热议问题