TanStackT
TanStack7mo ago
17 replies
then-purple

Failed to fetch dynamically imported module

I am trying to build & run my Tanstack Start project with Docker.

Building & running works, but I immediately get a runtime error and a network error:
GET http://localhost:3000/assets/main-WtU-nrR_.js net::ERR_CONTENT_LENGTHMISMATCH 200 (OK)
Uncaught (in promise) TypeError: Failed to fetch dynamically imported module: http://localhost:3000/assets/main-WtU-nrR
.js

I found another thread about this but nothing there helped: https://discord.com/channels/719702312431386674/1347600587012833402/1347652539402944665

Here's my vite.config.ts:
import { tanstackStart } from "@tanstack/react-start/plugin/vite";
import { defineConfig } from "vite";
import tsconfigPaths from "vite-tsconfig-paths";

const config = defineConfig({
  plugins: [
    tsconfigPaths(),
    tanstackStart({
      target: "node-server",
      tsr: {
        // @ts-expect-error - this is a config according to a runtime error I got with experimental.enableCodeSplitting
        autoCodeSplitting: true,
      },
    }),
  ],
});

export default config;
Screenshot_2025-07-01_at_16.55.30.png
Was this page helpful?