Skip to content

Usage with Vite version 5 #40

Description

@hyunchulkwak

I've been using vite-plugin-html-template to build multi page app with vite-plugin-mpa on Vite version 4.
Recently updated to Vite version 5 and found that it needs to set appType: 'mpa' on vite config to load a bundle file for each page.
Without the config pageName is not correctly found and falls back to index, which leads to every page loading a bundle file of index page.

Here req.url is .src/pages/test with Vite version 4. But with Vite version 5, it is /test without appType: 'mpa'.

let url = req.url
const pageName = (() => {
if (url === '/') {
return 'index'
}
return url.match(new RegExp(`${options.pagesDir}/(.*)/`))?.[1] || 'index'
})()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions