vite icon indicating copy to clipboard operation
vite copied to clipboard

fix: `build.modulePreload.resolveDependencies` is optimizable

Open sapphi-red opened this issue 1 year ago • 1 comments

Description

The document of build.modulePreload.resolveDependencies had

Returning a relative path to the hostId for hostType === 'js' is allowed, in which case new 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.

sapphi-red avatar Mar 03 '24 14:03 sapphi-red

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

/ecosystem-ci run

patak-dev avatar May 30 '24 08:05 patak-dev

📝 Ran ecosystem CI on 5caea89: Open

suite result latest scheduled
sveltekit :x: failure :x: failure
vike :x: failure :x: failure
vite-plugin-vue :x: failure :white_check_mark: success
vitest :x: failure :x: failure

:white_check_mark: analogjs, astro, histoire, ladle, laravel, marko, nuxt, previewjs, quasar, qwik, rakkas, remix, unocss, vite-plugin-pwa, vite-plugin-react, vite-plugin-react-pages, vite-plugin-react-swc, vite-plugin-svelte, vite-setup-catalogue, vitepress

vite-ecosystem-ci[bot] avatar May 30 '24 08:05 vite-ecosystem-ci[bot]

Resolved conflicts 👍 I guess the vite-plugin-vue fail happened because the branch was old.

sapphi-red avatar May 31 '24 14:05 sapphi-red

/ecosystem-ci run

sapphi-red avatar May 31 '24 14:05 sapphi-red