handle vue dependencies in nuxt 3 with externals or 'smart' transpilation
See original GitHub issueSummary
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
- Users can manually add any such libraries to
build.transpile
- this is our current recommendation. - Building on 1, we can also use vite’s dependency graph to detect nested dependencies of vue and recommend adding them to
build.transpile
- We can fully externalise
vue
, at the cost of greater disk space and the danger of resolving multiple vue versions depending on the ESM status of dependencies. - Building on 3, we can also improve our NFT support by adding ‘soft-transpilation’ to optimize/tree-shake externals.
Related issues
Issue Analytics
- State:
- Created a year ago
- Reactions:11
- Comments:13 (3 by maintainers)
Top Results From Across the Web
The build Property - Nuxt
Runtime dependencies (modules, nuxt.config , server middleware and static directory) are not bundled. This feature only disables use of webpack-externals for ...
Read more >Nuxt 3 first steps. - ITNEXT
Now, during my research, I found a lot of tutorials on how to connect Nuxt 3 with new modules like i18n, Algolia, or...
Read more >Release Notes - Nuxt.js
Nuxt requires all peer like dependencies as a dependency for easier usage. Sometimes this causes unwanted behaviors when users explicitly add a specific...
Read more >Nuxt 3 覚書 - Zenn
Headless UI · headlessui.com favicon image headlessui.com ; handle vue dependencies in nuxt 3 with externals or 'smart' transpilation · Issue # ...
Read more >Browser Compatibility | Vue CLI
If the dependency ships ES5 code and explicitly lists the polyfills needed: you can pre-include the needed polyfills using the polyfills option ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@danielroe oh sorry, I was meant to comment on this issue https://github.com/nuxt/framework/issues/2530. It turned out I have different vue version set in different packages, once I unified them the problem went away.
hi @danielroe , it still happens with