Skip to content

Vite plugin + Redirects #325

@sarink

Description

@sarink

In order to deploy a SPA, usually you use

# netlify.toml
[[redirects]]
  from = "/*"
  to = "/index.html" 
  status = 200

While this works when deployed, it breaks local development. Loading the app over localhost returns a blank page and the console error:

Failed to load module script: Expected a JavaScript-or-Wasm module script but the server responded with a MIME type of "". Strict MIME type checking is enforced for module scripts per HTML spec.

Removing the redirects line from netlify.toml makes local development (vite) work again, but then breaks in prod when you deploy.

What's the solution?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions