Skip to content
This repository was archived by the owner on Apr 6, 2023. It is now read-only.
/frameworkPublic archive

feat(nuxt): experimental flag to use external vue dependencies - #5083

Merged
pi0 merged 6 commits into
mainfrom
feat/vue-externals
Jun 10, 2022
Merged

feat(nuxt): experimental flag to use external vue dependencies#5083
pi0 merged 6 commits into
mainfrom
feat/vue-externals

Conversation

@danielroe

Copy link
Copy Markdown
Member

🔗 Linked issue

nuxt/nuxt#13632

❓ Type of change

  • 📖 Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

This PR starts exploring implementing moving vue, @vue/* and vue-router to externals. As it is, it is not the solution. Although it works, we have (at least) the following issues:

  • multiple copies of imports are included, for almost all vue and @vue libs, meaning an increase of ~2.2M (688kB -> 2.9M) in node_modules for a minimal project using pages/ - but note that the total.output/server size decreases slightly from 3.3M -> 3.2M. (Note: we can improve this into a much larger decrease by implementing import conditions upstream in vue.)
  • there are extra, non-treeshaken bits of vue-router that we could prune (such as other forms of router history and all code behind isBrowser flag)
  • unneeded parts of the vue api, such as @vue/devtools-api, are included in server node_modules

Some ideas to explore:

  • 'light' processing of Vue externals - extra compilation steps to strip browser or dev-only code?
  • manual post-build step to remove dev cjs builds
  • import conditions (development/production) for Vue core libraries

📝 Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@danielroedanielroe self-assigned this May 20, 2022
@netlify

netlifyBot commented May 20, 2022

Copy link
Copy Markdown

Deploy Preview for nuxt3-docs canceled.

NameLink
🔨 Latest commite2d052d
🔍 Latest deploy loghttps://app.netlify.com/sites/nuxt3-docs/deploys/62a3358d8236f700085318ec

@pi0

pi0 commented May 31, 2022

Copy link
Copy Markdown
Member

@danielroe While this should be default soon, can we please have the externalization behind an experimental flag in order to merge and test earlier? 🙏🏼 I belive this can also help to try and find nitro enhancements to tree-shake node_modules

Comment threadpackages/nuxt/src/core/nitro.ts Outdated
Comment threadpackages/schema/src/config/experimental.ts
@danielroe
danielroe marked this pull request as ready for review June 10, 2022 11:38
Comment threadpackages/vite/src/server.ts Outdated
@pi0pi0 changed the title fix(nuxt): use external vue, @vue/ and vue-routerfeat(nuxt): experimental flag to use external vue dependenciesJun 10, 2022
Comment threadpackages/vite/src/server.ts Outdated
pi0
pi0 approved these changes Jun 10, 2022
@pi0
pi0 merged commit 11a7340 into mainJun 10, 2022
@pi0
pi0 deleted the feat/vue-externals branch June 10, 2022 14:31
@pi0pi0 mentioned this pull request Jun 12, 2022
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@danielroe@pi0