question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

handle vue dependencies in nuxt 3 with externals or 'smart' transpilation

See original GitHub issue

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

  1. Users can manually add any such libraries to build.transpile - this is our current recommendation.
  2. Building on 1, we can also use vite’s dependency graph to detect nested dependencies of vue and recommend adding them to build.transpile
  3. 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.
  4. Building on 3, we can also improve our NFT support by adding ‘soft-transpilation’ to optimize/tree-shake externals.

Related issues

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:11
  • Comments:13 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
zipmecommented, Jun 15, 2022

@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.

1reaction
zipmecommented, Jun 15, 2022

hi @danielroe , it still happens with

experimental: {
  externalVue: true,
},
Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found