#Getting "Failed to load module" error in dev

9 messages · Page 1 of 1 (latest)

naive sorrel
#

Getting this error: login:1 Failed to load module script: Expected a JavaScript-or-Wasm module script but the server responded with a MIME type of "text/html". Strict MIME type checking is enforced for module scripts per HTML spec. in my dev server.

I have tried most of the suggestions online, but most of those seem related to production builds or the "base" arg in Vite Config. None of that seems to help my case though

deft veldt
#

full repro project please

naive sorrel
deft veldt
#

which path does it try load here?

#

more details please

naive sorrel
# deft veldt which path does it try load here?

It just happens on the login screen of our app. It SSR renders but doesn't load any additional JS so anything interactive doesn't work.

Versions:

    "@tanstack/react-router": "1.157.2",
    "@tanstack/react-router-devtools": "1.157.2",
    "@tanstack/react-router-ssr-query": "1.157.2",
    "@tanstack/react-start": "1.157.2",
    "nitro": "npm:nitro-nightly@latest",

We use a basepath of /new.

Vite Config:

import { tanstackStart } from "@tanstack/react-start/plugin/vite"
import react from "@vitejs/plugin-react"
import { nitro } from "nitro/vite"
import { dirname, resolve } from "node:path"
import { fileURLToPath } from "node:url"
import { defineConfig } from "vite"
import viteTsConfigPaths from "vite-tsconfig-paths"

const __dirname = dirname(fileURLToPath(import.meta.url))

export default defineConfig({
  server: {
    port: 3000,
  },
  plugins: [
    nitro(),
    viteTsConfigPaths({
      projects: ["./tsconfig.json"],
    }),
    tanstackStart({
      router: {
        quoteStyle: "double",
        semicolons: false,
        disableLogging: false,
        basepath: "/new",
      },
    }),
    react(),
  ],
  css: {
    postcss: "./postcss.config.cjs",
  },
  build: {
    sourcemap: true,
  },
})

Clicking on the "login:1" in the console shows me "No resource with given identifier found" (screenshot 2). But sometimes that also just shows the correct HTML instead. Depending a bit on which Vite COnfig settigns I have

deft veldt
#

are you using latest nitro alpha or nightly?

#

when did you bump that ?

naive sorrel