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.

assets in css include '__NUXT_BASE__' prefix in production build

See original GitHub issue

Environment


  • Operating System: Darwin
  • Node Version: v17.3.1
  • Nuxt Version: 3.0.0-27375427.d07d572
  • Package Manager: yarn@3.2.0-rc.10
  • Bundler: Vite
  • User Config: publicRuntimeConfig, privateRuntimeConfig, buildModules, css, vite, unocss
  • Runtime Modules: -
  • Build Modules: @vueuse/nuxt@7.5.3, unplugin-icons/nuxt, @unocss/nuxt@0.22.4

Reproduction

Describe the bug

I suspect this may be related to #2655.

It only affects yarn build.

@font-face {
    font-family: "SpaceGroteskLight";
    src: url("assets/fonts/SpaceGrotesk-Light.ttf");
    font-display: swap;
}

Additional context

No response

Logs

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:23 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
Jos-de-Bosscommented, Jan 19, 2022

I’ve updated the CodeSandBox reproduction I made for #2261 to include a font example: https://codesandbox.io/s/nuxt-3-missing-images-and-font-prod-3-0-0-27375427-d07d572-3cpwz

3reactions
exreplaycommented, Jan 23, 2022

I also had the problem with fonts in css and could fix it by setting the base path for the vite config.

export default defineNuxtConfig({
  // ...
  vite: {
    base: '/_nuxt/'
  }
  // ...
});

Found it here https://github.com/nuxt/framework/blob/c80870ad8c4a1c1b044d7a5ae27e41e997f8a75f/packages/vite/src/vite.ts#L53

Read more comments on GitHub >

github_iconTop Results From Across the Web

Assets directory
The assets directory contains your un-compiled assets such as Stylus or Sass files, images, or fonts.
Read more >
The build Property
The build property. Nuxt lets you customize the webpack configuration for building your web application as you want. analyze. Nuxt use webpack-bundle- ...
Read more >
Static directory
The static directory is directly mapped to the server root () and contains files that likely won't be changed. All included files will...
Read more >
Configuration
Nuxt lets you define the CSS files/modules/libraries you want to set globally (included in every page). In case you want to use sass...
Read more >
The css Property
Nuxt lets you define the CSS files/modules/libraries you want to set globally (included in every page). In case you want to use sass...
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