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.

Duplicate <link rel='preload'> and <script>, Browser warning to add "crossoriging" to link and "as" to script for Nuxt generated page sources

See original GitHub issue

Discussed in https://github.com/nuxt/nuxt.js/discussions/10612

<div type='discussions-op-text'>

Originally posted by Envoy49 August 1, 2022 Hi, I have got two types of browser warnings asking me to add “crossorigin” and “as” to the relevant preloaded JS resources created by NUXT itself. I have done all research I could, tried different webpack configurations and failed all the time. I don’t understand what is the problem and what is the source of it? Is it because of nuxt-bridge I am using? Seen similar problems but people had access to the html tag to be able to add missing property, in my case I don’t understand how I can manipulate it.

Using : “nuxt-edge”: “^2.16.0-27358576.777a4b7f” and “@nuxt/bridge”: “npm:@nuxt/bridge-edge”, node version: 14.8

Screen Shot 2022-08-01 at 11 53 19 am Screen Shot 2022-08-01 at 11 53 08 am

I think that I should be able to fix it in nuxt.config but not sure what needs to be done. Will appreciate any help

UPDATE: I am getting script tags with “as” in the page source. Wondering why the warning still appearing in the console


    <link rel="preload" href="/_nuxt/app~._.nuxt_A.js" as="script" />
    <link rel="preload" href="/_nuxt/app~._.nuxt_A.css" as="style" />
    <link rel="preload" href="/_nuxt/app~._a.css" as="style" />
    <link rel="preload" href="/_nuxt/app~._a.js" as="script" />
    <link rel="preload" href="/_nuxt/app~._l.js" as="script" />
    <link rel="preload" href="/_nuxt/app~._layouts_d.js" as="script" />
    <link rel="preload" href="/_nuxt/app~._n.js" as="script" />
    <link
      rel="preload"
      href="/_nuxt/app~._node_modules_atlas_node_modules_vue_dist_vue.runtime.esm.js~8cb01656.js"
      as="script"
    />
    <link
      rel="preload"
      href="/_nuxt/app~._node_modules_atlas_src_c.js"
      as="script"
    />
    <link rel="preload" href="/_nuxt/app~._node_modules_ba.js" as="script" />
    <link rel="preload" href="/_nuxt/app~._node_modules_c.js" as="script" />
    <link rel="preload" href="/_nuxt/app~._node_modules_h.js" as="script" />
    <link rel="preload" href="/_nuxt/app~._node_modules_i.js" as="script" />
    <link rel="preload" href="/_nuxt/app~._node_modules_vue-c.js" as="script" />
    <link
      rel="preload"
      href="/_nuxt/app~._node_modules_vue_dist_vue.runtime.esm.js~6acccc03.js"
      as="script"
    />
    <link
      rel="preload"
      href="/_nuxt/header-bar-mobile-menu~._node_modules_atlas_src_components_HeaderBar_HeaderBarMobileMenu.vue~0.js"
      as="script"
    />
    <link rel="preload" href="/_nuxt/pages/index~._c.css" as="style" />
    <link rel="preload" href="/_nuxt/pages/index~._c.js" as="script" />
    <link
      rel="preload"
      href="/_nuxt/pages/_~pages/index~pages/preview/_~pages/search~._c.js"
      as="script"
    />
    <link rel="preload" href="/_nuxt/0.js" as="script" />
</div>

I can see this PR ----> https://github.com/nuxt/nuxt.js/pull/7709 merged back in 2020, related to missing “crossorigin” Wondering if it fixed issue and I am not using the version which has it missing.

UPDATE:

I just discovered that the same scripts are at the bottom of my page and has “crossorigin” attribute. So basically first error is coming from the HEAD html tag where I got all my preloaded scripts without “crossorigin” tag and the second error message is coming from bottom of the page where I have “crossorigin” tag withouth “as”.


    <script src="/_nuxt/app~._.nuxt_A.js" defer crossorigin></script>
    <script src="/_nuxt/app~._a.js" defer crossorigin></script>
    <script src="/_nuxt/app~._la.js" defer crossorigin></script>
    <script src="/_nuxt/app~._m.js" defer crossorigin></script>
    <script src="/_nuxt/app~._n.js" defer crossorigin></script>
    <script src="/_nuxt/app~._node_modules_an.js" defer crossorigin></script>
    <script
      src="/_nuxt/app~._node_modules_atlas_src_c.js"
      defer
      crossorigin
    ></script>
    <script src="/_nuxt/app~._node_modules_ba.js" defer crossorigin></script>
    <script src="/_nuxt/app~._node_modules_c.js" defer crossorigin></script>
    <script src="/_nuxt/app~._node_modules_h.js" defer crossorigin></script>
    <script src="/_nuxt/app~._node_modules_i.js" defer crossorigin></script>
    <script src="/_nuxt/app~._node_modules_vue-c.js" defer crossorigin></script>
    <script
      src="/_nuxt/app~._node_modules_vue_dist_vue.runtime.esm.js~6acccc03.js"
      defer
      crossorigin
    ></script>

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:17 (4 by maintainers)

github_iconTop GitHub Comments

6reactions
danielroecommented, Aug 3, 2022

This will be fixed when we upgrade to the new version of vue-bundle-renderer.

4reactions
danielroecommented, Aug 7, 2022

Should be this week.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Duplicate <link rel='preload'> and <script>, Browser warning ...
Duplicate <link rel='preload'> and <script>, Browser warning to add "crossoriging" to link and "as" to script for Nuxt generated page sources.
Read more >
link[rel="preload"] header is always generate as [as="script"]
This making duplicate file load. This bug report is available on Nuxt community (#c8064). The text was updated successfully, but these errors ...
Read more >
The render Property - Nuxt
Nuxt lets you customize runtime options for rendering pages. ... the crossorigin attribute on <link rel="stylesheet"> and <script> tags in generated HTML.
Read more >
Safari Technology Preview Release Notes - Apple Developer
Fixed an issue where browser.tabs sometimes returned an incorrect URL for pinned tabs. Bug Fixes. Fixed the Share Menu when sharing an image...
Read more >
Link types - HTML: HyperText Markup Language | MDN
Link Type Allowed in these elements Not allowed in these elements alternate, , author, , icon, ,
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