-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
handle vue dependencies in nuxt 3 with externals or 'smart' transpilation #13632
Comments
Hi @danielroe should adding the library to |
My concern about option 1 is that it's going to increase the runtime of the build. And considering that there are going to be many packages that have |
We have same issue in our project with dev erroring out:
This is only when we slot <Nuxt* /> components through our UI lib like this: <UIProvider theme="foo">
<NuxtLink to="foobar">Foobar</NuxtLink>
</UIProvider> but works fine in this scenario: <UIProvider theme="foo">
<h1>Hello World</h1>
</UIProvider>
|
@dakt Interesting you are in a monorepo too, it does sound like build.transpile doesn't work in monorepos. I would be really interested if you find a solution! This is a pretty big blocker for us at the moment and is ruining our otherwise lovely monorepo setup haha |
Didn't spend much time trying to figure out why |
hi @danielroe , it still happens with experimental: {
externalVue: true,
}, |
@zipme Would you be able to share a reproduction? 🙏 |
@danielroe oh sorry, I was meant to comment on this issue #13117. It turned out I have different vue version set in different packages, once I unified them the problem went away. |
@danielroe I was able to add |
@danielroe Were there any recent changes regarding this topic? Because we noticed, that you are required to add |
No, there should not be a change. There might have been a change in vite or nitro bundling though, so if you are happy to raise a new issue, we can look to resolve it. |
This was fixed for me by removing all of the |
we are now handling dependencies as external by default |
Summary
At the moment, in both Bridge & Nuxt 3, we transpile
vue
. This decreases the space taken up in our server builds, and also protects against multiple instances of Vue being present in development (or even in build, due to ESM resolution issues).However, it comes with the issue that if the end user adds any libraries or other files (outside of their project) that import vue, we now have multiple copies of Vue present - both the version that has been bundled and an external version in
node_modules
.It also means that it is more difficult for users to pick the version of Vue they wish to use in their project (for example, if they want a version with a runtime compiler).
Possible solutions
build.transpile
- this is our current recommendation.build.transpile
vue
, at the cost of greater disk space and the danger of resolving multiple vue versions depending on the ESM status of dependencies.Related issues
The text was updated successfully, but these errors were encountered: