Skip to content
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

fix(scan): set namespace when resolving to html #2174

Merged
merged 1 commit into from
Feb 22, 2021

Conversation

jonaskuske
Copy link
Contributor

@jonaskuske jonaskuske commented Feb 22, 2021

fix #2163

When the wildcard resolver used by the dependency scanner resolves an import to an HTML/Vue/Svelte file, it currently doesn't set the 'html' namespace. Because of this, the HTML loader doesn't handle the import and it is handled by esbuild instead, which can't handle the file and throws.

import './App'
↓
handled by build.onResolve({ filter: /.*/ })
↓
resolved to '/.../App.vue' because of resolve.extensions: ['.vue', ...]
↓
NOT handled by build.onLoad({ filter: htmlTypesRE }) because of missing namespace
↓
error

By the way, wasn't sure why namespacing the HTML loader was necessary in the first place, is there a reason why it was only meant to handle files resolved from the main HTML file resolver and not the wildcard one?
But tests still pass now that HTML deps resolved from the wildcard resolver are handled too, so hope this is fine :)

@yyx990803 yyx990803 merged commit 3be4fac into vitejs:main Feb 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[bug] File could not be loaded with resolve.extensions: ['.vue', '.ts']
2 participants