Vue.JS routing issue where URIs with more than one q param do not route on page reload but load a blank page that is a 404 in the dev tools->network tab.
-
I am not using Netlify functions or other advanced routing.
-
I have a _redirects file that is verified to be in the root directory of the latest deploy file browser (adjacent the the index.html file) and contains:
/assets/* /assets/:splat 200
/* /index.html 200 -
The vue.JS router/index.js file is using web history.
import { createRouter, createWebHistory } from ‘vue-router’;
…
const router = createRouter({
history: createWebHistory(),
routes: [
{
path: ‘/’,
name: ‘home’,
component: HomeView,
},
…
-
in the deploy summary, I see:
2 redirect rules processed
All redirect rules deployed without errors. -
If I reload a page that is two q params deep then in browser dev tools->console I see:
Failed to load module script: Expected a JavaScript-or-Wasm module script but the server responded with a MIME type of “text/html”. Strict MIME type checking is enforced for module scripts per HTML spec.
index-DN-zPD7V.js:1
Which in the dev tool->network tab is located athttps://elliott-cv3.netlify.app/course/assets/index-DN-zPD7V.jsbut in the deploy file browser is located athttps://elliott-cv3.netlify.app/assets/index-DN-zPD7V.js -
My vite config.js file reads as follows:
import { fileURLToPath, URL } from 'node:url' import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' import vueDevTools from 'vite-plugin-vue-devtools' import tailwindcss from '@tailwindcss/vite' export default defineConfig({ plugins: [ vue(), vueDevTools(), tailwindcss(), ], resolve: { alias: { '@': fileURLToPath(new URL('./src', import.meta.url)) } }, build: { assetsDir: 'assets', outDir: 'dist' }, base: './' }) -
if I try and force the route then nothing loads
./assets/* /assets/:splat 200
/* /index.html 200!
Any help in understanding why this routing is going wrong would be greatly appreciated. TIA.