vitejs / vite-plugin-vue

Vite Vue Plugins
MIT License
477 stars 152 forks source link

Error while reading node_modules/.vite when replicating vue app in kubernetes #406

Closed ZioPhil closed 4 months ago

ZioPhil commented 4 months ago

Related plugins

Describe the bug

I have a vue app that works without problems when executed in kubernetes on a single pod without replication. However, as soon as I try to replicate, it doesn't work anymore and it throws this kind of errors in the browser console when it tries to read content from node_modules/.vite (that I think is the vite cache):

Loading module from “https://srsproject.it/node_modules/.vite/deps/auth0.js?v=0a5335c3” was blocked because of a disallowed MIME type (“”). Loading module from “https://srsproject.it/node_modules/.vite/deps/chunk-U6BEPC57.js?v=ddbe559a” was blocked because of a disallowed MIME type (“”).

Reproduction

https://github.com/ZioPhil/SrsProjectReproduction

Steps to reproduce

Install docker, kubectl and minikube Download all files in the repo and cd into the folder Run minikube delete Run minikube start Run helm install nginx-ingress ingress-nginx/ingress-nginx In /etc/hosts pair srsproject.it with the ip returned by the command minikube ip In another terminal, run minikube tunnel Run kubectl apply -f . Run kubectl delete ingress client-ingress Run minikube dashboard A dashboard window will open in your browser, go to "Deployments", open "client-deployment" On the top right press "Scale resource" and scale it to 2 Open a browser tab, press CTRL+Shift +I, open srsproject.it in that window

System Info

System:
    OS: Linux 6.6 Alpine Linux
    CPU: (4) x64 Intel(R) Core(TM) i3-7020U CPU @ 2.30GHz
    Memory: 1.86 GB / 3.71 GB
    Container: Yes
    Shell: 1.36.1 - /bin/ash
  Binaries:
    Node: 21.7.3 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.5.0 - /usr/local/bin/npm
  npmPackages:
    @vitejs/plugin-vue: ^5.0.4 => 5.0.4 
    vite: ^5.2.11 => 5.2.11

Used Package Manager

npm

Logs

No response

Validations

ZioPhil commented 4 months ago

The problem was that i was using the development version of the app on kubernetes. You must use the production version, that is generated with vite build or npm run build, if you have it configured in your package.json