vite Dependency optimization imports package file twice #20610
Unanswered
Coding-Kiwi
asked this question in
Q&A
Replies: 1 comment 2 replies
-
|
It would be nice to see a full reproduction to understand better, but this is a known behavior and |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have the following setup:
my-package/use/toasts.js
my-package/components/Toasts.vue
project/Test.vue
But this does not work because toast.js is loaded twice:
toasts.js loaded from http://localhost:5173/node_modules/my-package/use/toasts.js?v=6cc3eb86
toasts.js loaded from http://localhost:5173/node_modules/.vite/deps/my-package_use_toasts.js?v=9bfa181b
Thus addToasts in my projects adds to a reactive array that has nothing to do with the reactive array in the package Toasts.vue
I can "fix" this by nuking dependency optimization for my package
But that does not feel like the right thing to do.
Beta Was this translation helpful? Give feedback.
All reactions