Git Product home page Git Product logo

Comments (4)

Tristan971 avatar Tristan971 commented on June 14, 2024 1

Changing to url('~/public/favicon.ico') does the trick.

No it doesn't really do the trick. Because this results in the static file being copied as an asset.

Which means that:

  • it doesn't benefit from proper browser caching afterwards, because of the name hashing
  • gets needlessly preloaded as if it was a critical part of the application (it's a referenced asset, technically, after all)

We're having this issue with our font faces, ie this (if we add the ~/public prefix to "fix" the warning):

@font-face {
  font-display: swap;
  font-family: "Poppins";
  font-style: normal;
  font-weight: 100;
  src:
    url("/fonts/poppins/poppins-v19-100.woff2") format("woff2"),
    url("/fonts/poppins/poppins-v19-100.woff") format("woff");
}

@font-face {
  font-display: swap;
  font-family: "Poppins";
  font-style: normal;
  font-weight: 300;
  src:
    url("/fonts/poppins/poppins-v19-300.woff2") format("woff2"),
    url("/fonts/poppins/poppins-v19-300.woff") format("woff");
}

[...]

This will then end up inside the manifest and all other places where we then have to specifically remove it from. And we still lose caching.

from nuxt.

stackblitz avatar stackblitz commented on June 14, 2024

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

from nuxt.

HigherOrderLogic avatar HigherOrderLogic commented on June 14, 2024

Changing to url('~/public/favicon.ico') does the trick.

And shouldn't it be this way to refer to local assets/public file?

from nuxt.

mkody avatar mkody commented on June 14, 2024

I'm also seeing those warnings on all my Nuxt projects where I'm referencing files in my styles.
3.11.0's release notes did mention a "reimplementation of Vite's public asset handling" with #26163

[...] this PR takes full control over public assets and bypasses the vite pipeline entirely for them.

With vite.publicDir.$resolve(val) now only returning false.

from nuxt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.