Skip to content

Vue router / Webpack dev server shows Cannot GET /path on page refresh now #1965

@alexhx5

Description

@alexhx5

Version

3.0.1

Reproduction link

https://codepen.io/anon/pen/XVzRJY

Steps to reproduce

Run default installation to create a new project:

vue init webpack projectName

The webpack.dev.conf.js has been updated in the last update and the routing doesn't work on localhost now in mode: 'history':

  1. Run: npm run dev
  2. Create any component (e.g. Contact.vue)
  3. Import it as usual and add the route (e.g. /contact)
  4. Add mode: 'history'

  • You won't be able to open the route by typing it in the address bar, you'll see: Cannot GET /contact
  • If you navigate to it by pressing a button with route link, you will see the component, but refresh the page and you'll get the same result: Cannot GET /contact

What is expected?

To work in mode: 'history' on localhost (npm run dev)

What is actually happening?

Router doesn't work in mode: 'history' on localhost (npm run dev)


Additional info:

https://stackoverflow.com/questions/48123503/why-does-vue-router-webpack-dev-server-shows-cannot-get-path-on-page-refresh

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions