Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

fix(vite): ignore virtual imports that aren't in vfs #4822

Merged
merged 6 commits into from
May 6, 2022
Merged

Conversation

derz
Copy link
Contributor

@derz derz commented May 5, 2022

Avoids rollup error plugin load hook should return a string, a { code, map } object, or nothing/null when using (custom) virtual imports.

πŸ”— Linked issue

nuxt/nuxt#13921

❓ 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

Check if the virtual module exist in nuxt and otherwise just ignore it (aka leave it up for the other loaders to handle that module). Avoids returning { code: null, map: null }.

Resolves nuxt/nuxt#13921

πŸ“ Checklist

  • I have linked an issue or discussion.
  • [] n/a. I have updated the documentation accordingly.

…nothing

Avoids rollup error `plugin load hook should return a string, a { code, map } object, or nothing/null` when using (custom) virtual imports.
@netlify
Copy link

netlify bot commented May 5, 2022

βœ… Deploy Preview for nuxt3-docs canceled.

Name Link
πŸ”¨ Latest commit 94dde9c
πŸ” Latest deploy log https://app.netlify.com/sites/nuxt3-docs/deploys/627505d65720020008c5f5b7

@danielroe danielroe added bug Something isn't working πŸ”¨ p3-minor-bug Priority 3: a bug in an edge case that only affects very specific usage vite labels May 5, 2022
Copy link
Member

@danielroe danielroe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like a good fix to me. Alternatively, we could change the prefix we're using here to virtual:nuxt or something.

@danielroe danielroe changed the title fix: check if virtual: import is handled via nuxt & otherwise ignore it fix(vite): ignore virtual: imports that aren't in vfs May 5, 2022
@pi0
Copy link
Member

pi0 commented May 6, 2022

@danielroe Can you please check failing CI?

@danielroe danielroe changed the title fix(vite): ignore virtual: imports that aren't in vfs fix(vite): ignore virtual imports that aren't in vfs May 6, 2022
@pi0 pi0 merged commit 31c67ad into nuxt:main May 6, 2022
@pi0
Copy link
Member

pi0 commented May 6, 2022

Thanks @derz πŸ’―

@pi0 pi0 mentioned this pull request May 6, 2022
@danielroe danielroe added the 3.x label Jan 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
3.x bug Something isn't working πŸ”¨ p3-minor-bug Priority 3: a bug in an edge case that only affects very specific usage vite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using custom virtual imports result in rollup error on build
3 participants