Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add vue to resolve.dedupe #1356

Closed
wants to merge 1 commit into from
Closed

Conversation

shigma
Copy link
Contributor

@shigma shigma commented Sep 17, 2022

Developers who wants to extend the theme may use libraries depending on different versions of vue, causing client errors. Adding vue to resolve.dedupe can avoid such conditions.

@brc-dd
Copy link
Member

brc-dd commented Sep 21, 2022

I don't think resolve.dedupe will work for us as we are using SSR + ESM builds. Also, I suppose one can create a vite.config.ts themselves and add this option there (along with SSR + CJS settings).

@shigma
Copy link
Contributor Author

shigma commented Sep 21, 2022

I don't think resolve.dedupe will work for us as we are using SSR + ESM builds.

Multiple instances of vue may cause failure in development and result in multiple chunks in the bundle.

I suppose one can create a vite.config.ts themselves and add this option there (along with SSR + CJS settings).

So does vitepress support vite config out of the box? (One may would like to use vitepress together with other component libraries.)

@brc-dd
Copy link
Member

brc-dd commented Sep 21, 2022

Multiple instances of vue may cause failure in development and result in multiple chunks in the bundle.

Yeah, I understood that part. But according to Vite's docs, that doesn't work on SSR + ESM builds (<-- that's what we are using here). One needs to use CJS mode for SSR for it to work. And regarding Vite config, yes it is supported.

@shigma
Copy link
Contributor Author

shigma commented Sep 24, 2022

But according to Vite's docs, that doesn't work on SSR + ESM builds.

Well I see. So should I just remove resolve.dedupe from SSR builds and keep the others?

@kiaking
Copy link
Member

kiaking commented Oct 20, 2022

Developers who wants to extend the theme may use libraries depending on different versions of vue

I think we should simply discourage users from using different versions of Vue...? What is the reason why you can't update the Vue version?

@kiaking kiaking added the build Related to the build system label Oct 20, 2022
@shigma
Copy link
Contributor Author

shigma commented Oct 20, 2022

@kiaking It is not about updating the vue version. Adding dependencies in a composite project may result in multiple instances of vue, something like root > vue and root > @vueuse/core > vue. This problem can be fixed but is sometimes hard to find out.

@kiaking
Copy link
Member

kiaking commented Jan 27, 2023

So, seems like Vite 4 still has same behavior at the moment. Maybe we should simple document about this issue...? It might be simpler.

@brc-dd Do you happen to have any news on this topic? 👀

@kiaking
Copy link
Member

kiaking commented Feb 24, 2023

@shigma Evan is currently looking into this problem. It's also an issue in Nuxt as well. While adding this option to Vite config is one way of solving it, but we're trying to fix the issues by looking into the problem deeper.

We're trying gather as much as reproduction here to see the actual cases. If you have reproduction code, please share. It would be super helpful 🙇

@yyx990803
Copy link
Member

Maybe only dedupe for client-side builds?

@brc-dd
Copy link
Member

brc-dd commented Sep 12, 2023

@brc-dd brc-dd closed this Sep 12, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
build Related to the build system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants