question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

modulepreload does not use CDN url

See original GitHub issue

Environment

  • Operating System: Linux
  • Node Version: v17.8.0
  • Nuxt Version: 3.0.0-27470397.9ebea90
  • Package Manager: yarn@1.22.18
  • Builder: vite
  • User Config: vue, vite, css, app, publicRuntimeConfig, build, buildModules, modern, hooks, meta
  • Runtime Modules: -
  • Build Modules: @pinia/nuxt@0.1.8

Reproduction

  • Define a CDN url via e.g. NUXT_APP_CDN_URL
  • Run server/index.mjs in production mode
  • Look for <link "modulepreload"...> There should be redundant entries: One with just a path and one with the correct CDN url
  • Note: The incorrect tags are injected on client side; SSR renders the correct urls

Describe the bug

If a CDN url is defined, <link> tags with modulepreload will be injected into <head> that wont have the CDN url prefixed. This happens on the client resulting in duplicated link tags: with and without CDN url. The actual import uses the correct url though.

Additional context

No response

Logs

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:2
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
pierrescommented, May 10, 2022

This issues has been fixed with RC-3. Thanks a lot!

0reactions
danielroecommented, Aug 13, 2022

@ErickLuis00 Would you open a new issue with a reproduction?

Actually, seems there already is one: https://github.com/nuxt/framework/issues/6586

Read more comments on GitHub >

github_iconTop Results From Across the Web

Resource Hints: modulepreload | Can I use... Support tables ...
"Can I use" provides up-to-date browser support tables for support of front-end web technologies on desktop and mobile web browsers.
Read more >
Link types: modulepreload - HTML - MDN Web Docs - Mozilla
The modulepreload keyword for the rel attribute of the <link> element provides a declarative way to preemptively fetch a module script and its ......
Read more >
Preload, prefetch and other <link> tags
Don't use <link rel="preload"> if you don't need a resource immediately after the page loads. If you only need it later – e.g.,...
Read more >
ES Module Preloading & Integrity - Guy Bedford
A major issue with using modulepreload as the primary integrity approach is there is no easy way to provide integrity upfront for lazy...
Read more >
Is it possible to use subresource integrity with ES6 module ...
From an HTML document, you can use the <link rel="modulepreload"> ... Please note, SRI doesn't address the sources (whether a URL, CDN, npm, ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found