The vue-router can't link to a right page in a multi-project or workspace
See original GitHub issue⚠️ IMPORTANT ⚠️ Please check the following list before proceeding. If you ignore this issue template, your issue will be directly closed.
- Read the docs.
- Use Vite >=2.0. (1.x is no longer supported)
- If the issue is related to 1.x -> 2.0 upgrade, read the Migration Guide first.
Describe the bug
The vue-router can’t go to the right page in the multi-page project with the config below ‘http://localhost:3000/nested/’ can go to the right page but 'http://localhost:3000/nested/userinfo ’ is 404 not found ‘http://localhost:3000/main/’ is 404, but ‘http://localhost:3000/main.html’ can go to page. if this app use vue-router the url is ‘http://localhost:3000/main.html/userinfo’ ?
// vite.config.ts
import { defineConfig } from 'vite';
import { resolve } from 'path';
import vue from '@vitejs/plugin-vue';
const port = 3000;
export default defineConfig({
plugins: [vue()],
build: {
rollupOptions: {
input: {
main: resolve(__dirname, 'main.html'),
about: resolve(__dirname, 'about.html'),
nested: resolve(__dirname, 'nested/index.html'),
}
}
},
server: {
port,
}
});
Reproduction
https://github.com/miniai/vite-multiple-page.git
System Info
vite
version: 2.0.0-beta.64- Operating System: win32-x64
- Node version: v12.6.0
- Package manager (npm/yarn/pnpm) and version: 6.9.0
Logs (Optional if provided reproduction)
404 not found
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Vue-router error: TypeError: Cannot read property 'matched' of ...
I'm using vue-cli and simple-webpack boilerplate. When I add vue-router links to my app component I get this error in console. Error in...
Read more >Build and Deploy a Single Page App with Vue 3 + Vite and Pinia
In this section of our guide, we'll be adding two new dependencies to our project: vue-router and pinia . Let's go ahead and...
Read more >How To Navigate Between Views with Vue Router
First, create the view that will act as the 404 page. Change into the views directory:
Read more >Managing Extensions in Visual Studio Code
You can select the extension item to display the extension's details page where ... in a multi-root workspace by using the Extensions: Configure...
Read more >How to Reuse Vue Components Between Projects - codeburst
Install the component in another project with npm/yarn. Modify the code right from the new project using Bit and update the changes as...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Has anyone found a workaround for this? I’m hitting the same issue (only in
vite dev
). I understand it’s outside the scope of vite itself, and it’s working as expected when I hook it up with my properly configured web server…but it’s pretty inconvenient when doing development work.I can use config 'historyApiFallback ’ in vue.config.js,but vite.config.ts didn’t has this config.