Why does Nuxt/Vite bundle the same library version twice under some circumstances?
I've had this issue with prosemirror and vee-validate where the packages didn't work correctly, because they relied on some sort of global state or Symbols that were bundled twice.
I fixed the issue by adding the packages to
vite.resolve.dedupe
in the nuxt config, but why do I need to do this in the first place? Why would it bundle a library twice?
In my case I think it happened because I have a monorepo with a UI component package and a nuxt app. Nuxt app has vee-validate
installed and the UI component package has vee-validate
installed as well. And I'm guessing Nuxt got confused when it saw vee-validate
at 2 different locations and bundled them twice.0 Replies