Skip to content

Public assets return 404 in dev with nitroViteEnvironment #35992

Closed as duplicate

Description

@onmax

Environment

Operating system: macOS 25.2.0
CPU: Apple M4
Node.js: v24.19.0
Package manager: pnpm 10.28.0
Nuxt: 5.0.0-29762631.396a4ae3
Nuxt CLI: 4.0.0-20260805-144501-08df710
Nitro: 3.0.260610-beta
Vite: 8.2.0
Vue: 3.5.41

Reproduction

Create a Nuxt 5 nightly app with the Nitro Vite environment enabled:

// nuxt.config.ts
export default defineNuxtConfig({
  experimental: {
    nitroViteEnvironment: true,
  },
})

Add any file under the Nuxt public directory:

public/hello.txt

Start the development server and request the file:

pnpm dev
curl -i http://localhost:3000/hello.txt

Describe the bug

Files in the resolved Nuxt public directory return an HTML 404 during development when experimental.nitroViteEnvironment is enabled.

Nuxt resolves the directories correctly:

{
  "nitroViteEnvironment": true,
  "vitePublicDir": false,
  "srcDir": "/path/to/project/app",
  "publicDir": "/path/to/project/public"
}

The public directory is also present in Nitro's resolved publicAssets, but requests for file-like paths do not reach Nitro's development static handlers. Vite is created with publicDir: false, so it does not serve them either. The result is:

HTTP/1.1 404 Not Found
content-type: text/html; charset=utf-8

The expected behavior is for /hello.txt to return the contents of public/hello.txt, matching ordinary Nuxt development behavior.

Additional context

N/A

Logs

N/A

Activity

  1. coderabbitai commented on Aug 5, 2026

    @coderabbitai
    Contributor
    🔗 Related PRs

    #35604 - feat(nitro,schema,vite): add experimental support for nitro/vite [merged]
    #35630 - fix(nitro): render error.vue for direct /__nuxt_error visits [open]
    #35674 - feat(nuxt): warn when public files override application routes [merged]
    #35891 - feat(schema): enable nitro vite environment by default in v5 [merged]
    #35931 - fix(nitro): correct dev and build behaviour for nitro/vite [merged]


    📝 Issue Planner

    Check the box below or use the @coderabbitai plan command to generate an implementation plan and prompts that you can use with your favorite coding assistant.

    • Create Plan

    🧪 Issue enrichment is currently in open beta.

    You can configure auto-planning by selecting labels in the issue_enrichment configuration.

    To disable automatic issue enrichment, add the following to your .coderabbit.yaml:

    issue_enrichment:
      auto_enrich:
        enabled: false

    💬 Have feedback or questions? Drop into our discord!

  2. added
    🔨 p3-minor
    and removed on Aug 5, 2026
  3. added theissue type on Aug 5, 2026
  4. danielroe commented on Aug 8, 2026

    @danielroe
    Member

    this was a nitro bug and has been resolved upstream in nitrojs/nitro#4467

  5. onmax commented on Aug 8, 2026

    @onmax
    MemberAuthor

    thanks! I thought it was 100% nuxt dev issue. I didn't think of checking nitro!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    5.xgood first issue🔨 p3-minor

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions