Skip to content

feat(cli-service): add history api fallback for multi-page mode #3181

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 19, 2019

Conversation

jkzing
Copy link
Member

@jkzing jkzing commented Dec 25, 2018

With multi-page configuration like:

module.exports = {
  pages: {
    main: {
      entry: 'src/main.js',
      template: 'public/index.html',
      filename: 'index.html'
    },
    preview: {
      entry: 'src/preview.js',
      template: 'public/index.html',
      filename: 'preview.html'
    }
  }
}

HTML for page preview can only be accessed by localhost:8080/preview.html.

This plays well with vue-router + hash mode. But with history mode, preview.html would not be accessible.

eg. accessing localhost:8080/preview.html/about will result in index.html because /preview.html/about is a not found request and being fallback.

This PR adds support for multi-page fallback, it fallback ${baseUrl}/${name of page} to the correct html file (filename specified or ${name}.html).

In above case, the two pages could be accessed by localhost:8080/main and localhost:8080/preview.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants