Skip to content
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

Multi-page mode example #257

Closed
chriscalo opened this issue May 25, 2020 · 12 comments
Closed

Multi-page mode example #257

chriscalo opened this issue May 25, 2020 · 12 comments
Labels
enhancement New feature or request

Comments

@chriscalo
Copy link

chriscalo commented May 25, 2020

Is your feature request related to a problem? Please describe.
I'm trying to get Vue3 + Vite working in multi-page mode.

Describe the solution you'd like
An example of how to use vite to build a multi-paged app, much like the pages option in the Vue CLI Config Reference.

Describe alternatives you've considered
I tried looking through the source to see if I could spot how this could be accomplished, but didn't find anything obvious I could try.

Additional context
I'm investigating using Vue3 + Vite to replace an existing Nuxt SSR solution, but perhaps the best answer here is to wait until things develop further to see which solutions emerge.

@ais-one
Copy link
Contributor

ais-one commented May 25, 2020

SSR feels like PHP again... generating content e.g. head tag information on the server site...

If it is a multi page static site (not sure about SSR), from what I know,..

  • state can only be passed between pages through query strings or fragments or localStorage
  • each page will have its own vue object (so each page can be an SPA)

@yyx990803 yyx990803 added the enhancement New feature or request label May 25, 2020
@yyx990803
Copy link
Member

Regardless of SSR, multi-page is something Vite does plan to support.

@husayt
Copy link
Contributor

husayt commented Jun 8, 2020

There is a simple demo by @posva here of vue with vue-router, but that doesn't handle generation of all entry points. i.e /about works in dev, but not with generated bundle. Will be great to see proper support mentioned by @yyx990803

@sujit-baniya
Copy link

Is there any update on this?

@ilmoi
Copy link

ilmoi commented Dec 8, 2020

Also interested if there's an update. Thanks.

@CryUshio
Copy link

Is there any update on this?

+1

@underfin
Copy link
Member

underfin commented Jan 2, 2021

Hey guys.The 2.0 support this feature. Please see https://vitejs.dev/guide/build.html#multi-page-app

@underfin underfin closed this as completed Jan 2, 2021
@Grafikart
Copy link

I have an issue with the way vite handle this. I have a build like this :

    rollupOptions: {
      input: {
        app: resolve(__dirname, 'assets/app.js'),
        admin: resolve(__dirname, 'assets/admin.js')
      }
    },

I'm expecting 2 file in the output : app.js and admin.js but I end up with 3 files

- app.js
- Modal.js
- admin.js

I guess Modal contains the code shared between the 2 files but in some case we may want vite to compile these 2 entry point as separate files (without the share libraries file).

@surjithctly
Copy link

I guess the current implementation is wrong.

What if I have 50+ pages, I have to mention every page in vite.config.js? Can't Vite do simple file-based routing?

(I'm using Vanilla JS)

@userquin
Copy link
Contributor

@surjithctly see vite-plugin-mpa.

Anyway, do not write on closed issues since ppl just ignore it.

@skywalker2013
Copy link

how to config vite.config.js file for deeper path page? as follows image, how to visit feedback page?
image

@github-actions
Copy link

This issue has been locked since it has been closed for more than 14 days.

If you have found a concrete bug or regression related to it, please open a new bug report with a reproduction against the latest Vite version. If you have any other comments you should join the chat at Vite Land or create a new discussion.

@github-actions github-actions bot locked and limited conversation to collaborators Jul 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests