vite
vite copied to clipboard
fix: `build.modulePreload.resolveDependencies` is optimizable
Description
The document of build.modulePreload.resolveDependencies
had
Returning a relative path to the
hostId
forhostType === 'js'
is allowed, in which casenew URL(dep, import.meta.url)
is used to get an absolute path when injecting this module preload in the HTML head.
, but actually this wasn't true. build.modulePreload.resolveDependencies
does not expect a relative path to the hostId
. It expects a relative path to build.outDir
. The result of build.modulePreload.resolveDependencies
is passed to toOutputFilePathWithoutRuntime
or toOutputFilePathInJS
.
close #13169 (indirectly)
Additional context
What is the purpose of this pull request?
- [x] Bug fix
- [ ] New Feature
- [ ] Documentation update
- [ ] Other
Before submitting the PR, please make sure you do the following
- [x] Read the Contributing Guidelines, especially the Pull Request Guidelines.
- [x] Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
- [x] Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g.
fixes #123
). - [x] Update the corresponding documentation if needed.
- [ ] Ideally, include relevant tests that fail without this PR but pass with it.