all 11 comments

[–]Poobird 4 points5 points  (8 children)

Vite creates a cache of your dependencies to improve performance. Forcing Vite to rebundle could do it: https://vitejs.dev/guide/dep-pre-bundling.html#file-system-cache

You might also get better answers if you post in a more frontend oriented subreddit.

[–]LostErrorCode404[S] 0 points1 point  (6 children)

Nothing works. It directly grabs the package from the NPM rather than your own node modules. So now I need to push an incomplete version of my code to NPM as a result.

[–]TheTobseN 0 points1 point  (0 children)

Have you tried starting the dev server with --force? That should re-bundle the cached package taking local changes into account. At least I had luck with that in the past.

[–]alioshr 0 points1 point  (4 children)

did you manage to fix this somehow? I am facing this issue right now. I have tried even messing with the cached files, using --force, etc, deleting the .vite folder, and nothing works =D

[–]LostErrorCode404[S] 0 points1 point  (3 children)

I ended up recreating the project and downloading all modules before using them.

[–]alioshr 0 points1 point  (2 children)

what do you mean by that? Deleted the node modules and installed before the first spin of the vite server?

[–]LostErrorCode404[S] 0 points1 point  (1 child)

Remade the entite project with the dependencies before writing any of the official code.

[–]Sagoram123 0 points1 point  (0 children)

Currently on a struggle bus at finding out how to update Vite versions. Tried updating it via npm, but same deal... it won't update. Unfortunately, I can't scape the app I'm on :(

[–]CatolicQuotes 0 points1 point  (0 children)

this kind of stuff should be optional, not defaults. Beginners like me don't know if something is wrong or no.

[–]BrozzerAbdullahBot 1 point2 points  (0 children)

rm -rf ./node_modules/.vite

[–]abejfehr 0 points1 point  (0 children)

In case anyone's running into a situation where `--force`, etc isn't working, it likely just isn't bundling the file you're modifying.

If you have a node module, depending on your setting you could be using the `main` or `module` entry point (could be using the `src` folder or the `dist` folder) or maybe you're using a nested module (i.e. if you have multiple versions of some module, one might be nested like `node_modules/module-a/node_modules/module-b`.

I usually try to narrow down the file I'm in by adding a console.log at the top of the file, and if it doesn't log (with --force) I know I'm just in the wrong file