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_LENGTH_MISMATCH 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: #1347600587012833402 message
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;