[GH-ISSUE #6341] Could not resolve "#tanstack-router-entry" #10489

Closed
opened 2026-04-13 06:40:14 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @amruthpillai on GitHub (Nov 26, 2025).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/6341

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

  1. Set up TanStack Start
  2. Set up Better Auth
  3. Use import { tanstackStartCookies } from "better-auth/tanstack-start"; and add the plugin to the end of the array of plugins.

This issue does not appear if I do import and use tanstackStartCookies.
The issue is also not present in v1.4.1 but present on v1.4.2 and v1.4.3.

Current vs. Expected behavior

This throws an error when I run bun run dev. Here is the full stack trace:

✘ [ERROR] Could not resolve "#tanstack-router-entry"

    node_modules/@tanstack/start-server-core/dist/esm/createStartHandler.js:29:33:
      29 │       routerEntry = await import("#tanstack-router-entry");
         ╵                                  ~~~~~~~~~~~~~~~~~~~~~~~~

  The package import "#tanstack-router-entry" is not defined in this "imports" map:

    node_modules/@tanstack/start-server-core/package.json:49:13:
      49 │   "imports": {
         ╵              ^

  You can mark the path "#tanstack-router-entry" as external to exclude it from the bundle, which
  will remove this error and leave the unresolved path in the bundle. You can also add ".catch()"
  here to handle this failure at run-time instead of bundle-time.

✘ [ERROR] Could not resolve "#tanstack-start-entry"

    node_modules/@tanstack/start-server-core/dist/esm/createStartHandler.js:32:32:
      32 │       startEntry = await import("#tanstack-start-entry");
         ╵                                 ~~~~~~~~~~~~~~~~~~~~~~~

  The package import "#tanstack-start-entry" is not defined in this "imports" map:

    node_modules/@tanstack/start-server-core/package.json:49:13:
      49 │   "imports": {
         ╵              ^

  You can mark the path "#tanstack-start-entry" as external to exclude it from the bundle, which
  will remove this error and leave the unresolved path in the bundle. You can also add ".catch()"
  here to handle this failure at run-time instead of bundle-time.

✅ Database migrations completed
✘ [ERROR] Could not resolve "tanstack-start-manifest:v"

    node_modules/@tanstack/start-server-core/dist/esm/router-manifest.js:3:44:
      3 │   const { tsrStartManifest } = await import("tanstack-start-manifest:v");
        ╵                                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~

  You can mark the path "tanstack-start-manifest:v" as external to exclude it from the bundle, which
  will remove this error and leave the unresolved path in the bundle. You can also add ".catch()"
  here to handle this failure at run-time instead of bundle-time.

✘ [ERROR] Could not resolve "tanstack-start-injected-head-scripts:v"

    node_modules/@tanstack/start-server-core/dist/esm/router-manifest.js:9:49:
      9 │     const { injectedHeadScripts } = await import("tanstack-start-injected-head-scripts:v");
        ╵                                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  You can mark the path "tanstack-start-injected-head-scripts:v" as external to exclude it from the
  bundle, which will remove this error and leave the unresolved path in the bundle. You can also add
  ".catch()" here to handle this failure at run-time instead of bundle-time.

1462 |     let { file, line, column } = e.location;
1463 |     let pluginText = e.pluginName ? `[plugin: ${e.pluginName}] ` : "";
1464 |     return `
1465 | ${file}:${line}:${column}: ERROR: ${pluginText}${e.text}`;
1466 |   }).join("");
1467 |   let error = new Error(text);
                         ^
error: Error during dependency optimization:

✘ [ERROR] Could not resolve "#tanstack-router-entry"

    node_modules/@tanstack/start-server-core/dist/esm/createStartHandler.js:29:33:
      29 │       routerEntry = await import("#tanstack-router-entry");
         ╵                                  ~~~~~~~~~~~~~~~~~~~~~~~~

  The package import "#tanstack-router-entry" is not defined in this "imports" map:

    node_modules/@tanstack/start-server-core/package.json:49:13:
      49 │   "imports": {
         ╵              ^

  You can mark the path "#tanstack-router-entry" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle. You can also add ".catch()" here to handle this failure at run-time instead of bundle-time.


✘ [ERROR] Could not resolve "#tanstack-start-entry"

    node_modules/@tanstack/start-server-core/dist/esm/createStartHandler.js:32:32:
      32 │       startEntry = await import("#tanstack-start-entry");
         ╵                                 ~~~~~~~~~~~~~~~~~~~~~~~

  The package import "#tanstack-start-entry" is not defined in this "imports" map:

    node_modules/@tanstack/start-server-core/package.json:49:13:
      49 │   "imports": {
         ╵              ^

  You can mark the path "#tanstack-start-entry" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle. You can also add ".catch()" here to handle this failure at run-time instead of bundle-time.


✘ [ERROR] Could not resolve "tanstack-start-manifest:v"

    node_modules/@tanstack/start-server-core/dist/esm/router-manifest.js:3:44:
      3 │ ...t { tsrStartManifest } = await import("tanstack-start-manifest:v");
        ╵                                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~

  You can mark the path "tanstack-start-manifest:v" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle. You can also add ".catch()" here to handle this failure at run-time instead of bundle-time.


✘ [ERROR] Could not resolve "tanstack-start-injected-head-scripts:v"

    node_modules/@tanstack/start-server-core/dist/esm/router-manifest.js:9:49:
      9 │ ...Scripts } = await import("tanstack-start-injected-head-scripts:v");
        ╵                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  You can mark the path "tanstack-start-injected-head-scripts:v" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle. You can also add ".catch()" here to handle this failure at run-time instead of bundle-time.

What version of Better Auth are you using?

^1.4.3

System info

{
  "system": {
    "platform": "darwin",
    "arch": "arm64",
    "version": "Darwin Kernel Version 25.1.0: Mon Oct 20 19:32:41 PDT 2025; root:xnu-12377.41.6~2/RELEASE_ARM64_T6000",
    "release": "25.1.0",
    "cpuCount": 10,
    "cpuModel": "Apple M1 Max",
    "totalMemory": "32.00 GB",
    "freeMemory": "3.06 GB"
  },
  "node": {
    "version": "v22.21.0",
    "env": "development"
  },
  "packageManager": {
    "name": "bun",
    "version": "1.3.3"
  },
  "frameworks": [
    {
      "name": "react",
      "version": "^19.2.0"
    }
  ],
  "databases": [
    {
      "name": "pg",
      "version": "^8.16.3"
    },
    {
      "name": "drizzle",
      "version": "^0.44.7"
    }
  ],
  "betterAuth": {
    "version": "^1.4.3",
    "config": null
  }
}

Which area(s) are affected? (Select all that apply)

Backend

Auth config (if applicable)

import { passkey } from "@better-auth/passkey";
import { BetterAuthError, betterAuth } from "better-auth";
import { drizzleAdapter } from "better-auth/adapters/drizzle";
import { type GenericOAuthConfig, genericOAuth, twoFactor } from "better-auth/plugins";
import { username } from "better-auth/plugins/username";
import { tanstackStartCookies } from "better-auth/tanstack-start";
import { db } from "@/integrations/drizzle/client";
import { env } from "@/utils/env";
import { generateId, toUsername } from "@/utils/string";
import { schema } from "../drizzle";

function isCustomOAuthProviderEnabled() {
	return (
		env.OAUTH_CLIENT_ID &&
		env.OAUTH_CLIENT_SECRET &&
		env.OAUTH_DISCOVERY_URL &&
		env.OAUTH_AUTHORIZATION_URL &&
		env.OAUTH_REDIRECT_URI
	);
}

const getAuthConfig = () => {
	const authConfigs: GenericOAuthConfig[] = [];

	if (isCustomOAuthProviderEnabled()) {
		authConfigs.push({
			providerId: "custom",
			clientId: env.OAUTH_CLIENT_ID as string,
			clientSecret: env.OAUTH_CLIENT_SECRET,
			discoveryUrl: env.OAUTH_DISCOVERY_URL,
			authorizationUrl: env.OAUTH_AUTHORIZATION_URL,
			redirectURI: env.OAUTH_REDIRECT_URI,
			mapProfileToUser: async (profile) => {
				if (!profile.email) {
					throw new BetterAuthError(
						"OAuth Provider did not return an email address. This is required for user creation.",
						"EMAIL_REQUIRED",
					);
				}

				const email = profile.email;
				const name = profile.name ?? profile.preferred_username ?? email.split("@")[0];
				const username = profile.preferred_username ?? email.split("@")[0];
				const image = profile.image ?? profile.picture ?? profile.avatar_url;

				return {
					name,
					email,
					image,
					username,
					displayUsername: username,
					emailVerified: true,
				};
			},
		} satisfies GenericOAuthConfig);
	}

	return betterAuth({
		appName: "REDACTED",
		secret: env.AUTH_SECRET,

		database: drizzleAdapter(db, { schema, provider: "pg" }),

		telemetry: { enabled: false },
		advanced: {
			database: { generateId },
			useSecureCookies: env.APP_URL.startsWith("https://"),
		},

		emailAndPassword: {
			enabled: true,
			autoSignIn: true,
			minPasswordLength: 6,
			maxPasswordLength: 64,
			requireEmailVerification: false,
			disableSignUp: env.FLAG_DISABLE_SIGNUP,
			sendResetPassword: async ({ user, url }) => {
				console.log(`[EMAIL] [${user.email}] To reset your password, please visit the following URL: ${url}`);
			},
			password: {
				hash: (password) => Bun.password.hash(password),
				verify: ({ password, hash }) => Bun.password.verify(password, hash),
			},
		},

		emailVerification: {
			sendOnSignUp: true,
			autoSignInAfterVerification: true,
			sendVerificationEmail: async ({ user, url }) => {
				console.log(`[EMAIL] [${user.email}] To verify your email, please visit the following URL: ${url}`);
			},
		},

		user: {
			changeEmail: {
				enabled: true,
				sendChangeEmailVerification: async ({ user, newEmail, url }) => {
					console.log(
						`[EMAIL] [${user.email}] To change your email to ${newEmail}, please visit the following URL: ${url}`,
					);
				},
			},
			additionalFields: {
				username: {
					type: "string",
					required: true,
				},
			},
		},

		socialProviders: {
			google: {
				enabled: !!env.GOOGLE_CLIENT_ID && !!env.GOOGLE_CLIENT_SECRET,
				// biome-ignore lint/style/noNonNullAssertion: enabled check ensures these are not null
				clientId: env.GOOGLE_CLIENT_ID!,
				// biome-ignore lint/style/noNonNullAssertion: enabled check ensures these are not null
				clientSecret: env.GOOGLE_CLIENT_SECRET!,
				mapProfileToUser: async (profile) => {
					return {
						name: profile.name,
						email: profile.email,
						image: profile.picture,
						username: profile.email.split("@")[0],
						displayUsername: profile.email.split("@")[0],
						emailVerified: true,
					};
				},
			},

			github: {
				enabled: !!env.GITHUB_CLIENT_ID && !!env.GITHUB_CLIENT_SECRET,
				// biome-ignore lint/style/noNonNullAssertion: enabled check ensures these are not null
				clientId: env.GITHUB_CLIENT_ID!,
				// biome-ignore lint/style/noNonNullAssertion: enabled check ensures these are not null
				clientSecret: env.GITHUB_CLIENT_SECRET!,
				mapProfileToUser: async (profile) => {
					return {
						name: profile.name,
						email: profile.email,
						image: profile.avatar_url,
						username: profile.login,
						displayUsername: profile.login,
						emailVerified: true,
					};
				},
			},
		},

		plugins: [
			username({
				minUsernameLength: 3,
				maxUsernameLength: 64,
				usernameNormalization: (value) => toUsername(value),
				displayUsernameNormalization: (value) => toUsername(value),
				validationOrder: { username: "post-normalization", displayUsername: "post-normalization" },
			}),
			twoFactor({ issuer: "REDACTED" }),
			passkey({ rpName: "REDACTED", rpID: "localhost" }),
			genericOAuth({ config: authConfigs }),
			tanstackStartCookies(),
		],
	});
};

export const auth = getAuthConfig();

Additional context

No response

Originally created by @amruthpillai on GitHub (Nov 26, 2025). Original GitHub issue: https://github.com/better-auth/better-auth/issues/6341 ### Is this suited for github? - [x] Yes, this is suited for github ### To Reproduce 1. Set up TanStack Start 2. Set up Better Auth 3. Use `import { tanstackStartCookies } from "better-auth/tanstack-start";` and add the plugin to the end of the array of plugins. This issue does not appear if I do import and use `tanstackStartCookies`. The issue is also not present in `v1.4.1` but present on `v1.4.2` and `v1.4.3`. ### Current vs. Expected behavior This throws an error when I run `bun run dev`. Here is the full stack trace: ``` ✘ [ERROR] Could not resolve "#tanstack-router-entry" node_modules/@tanstack/start-server-core/dist/esm/createStartHandler.js:29:33: 29 │ routerEntry = await import("#tanstack-router-entry"); ╵ ~~~~~~~~~~~~~~~~~~~~~~~~ The package import "#tanstack-router-entry" is not defined in this "imports" map: node_modules/@tanstack/start-server-core/package.json:49:13: 49 │ "imports": { ╵ ^ You can mark the path "#tanstack-router-entry" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle. You can also add ".catch()" here to handle this failure at run-time instead of bundle-time. ✘ [ERROR] Could not resolve "#tanstack-start-entry" node_modules/@tanstack/start-server-core/dist/esm/createStartHandler.js:32:32: 32 │ startEntry = await import("#tanstack-start-entry"); ╵ ~~~~~~~~~~~~~~~~~~~~~~~ The package import "#tanstack-start-entry" is not defined in this "imports" map: node_modules/@tanstack/start-server-core/package.json:49:13: 49 │ "imports": { ╵ ^ You can mark the path "#tanstack-start-entry" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle. You can also add ".catch()" here to handle this failure at run-time instead of bundle-time. ✅ Database migrations completed ✘ [ERROR] Could not resolve "tanstack-start-manifest:v" node_modules/@tanstack/start-server-core/dist/esm/router-manifest.js:3:44: 3 │ const { tsrStartManifest } = await import("tanstack-start-manifest:v"); ╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ You can mark the path "tanstack-start-manifest:v" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle. You can also add ".catch()" here to handle this failure at run-time instead of bundle-time. ✘ [ERROR] Could not resolve "tanstack-start-injected-head-scripts:v" node_modules/@tanstack/start-server-core/dist/esm/router-manifest.js:9:49: 9 │ const { injectedHeadScripts } = await import("tanstack-start-injected-head-scripts:v"); ╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ You can mark the path "tanstack-start-injected-head-scripts:v" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle. You can also add ".catch()" here to handle this failure at run-time instead of bundle-time. 1462 | let { file, line, column } = e.location; 1463 | let pluginText = e.pluginName ? `[plugin: ${e.pluginName}] ` : ""; 1464 | return ` 1465 | ${file}:${line}:${column}: ERROR: ${pluginText}${e.text}`; 1466 | }).join(""); 1467 | let error = new Error(text); ^ error: Error during dependency optimization: ✘ [ERROR] Could not resolve "#tanstack-router-entry" node_modules/@tanstack/start-server-core/dist/esm/createStartHandler.js:29:33: 29 │ routerEntry = await import("#tanstack-router-entry"); ╵ ~~~~~~~~~~~~~~~~~~~~~~~~ The package import "#tanstack-router-entry" is not defined in this "imports" map: node_modules/@tanstack/start-server-core/package.json:49:13: 49 │ "imports": { ╵ ^ You can mark the path "#tanstack-router-entry" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle. You can also add ".catch()" here to handle this failure at run-time instead of bundle-time. ✘ [ERROR] Could not resolve "#tanstack-start-entry" node_modules/@tanstack/start-server-core/dist/esm/createStartHandler.js:32:32: 32 │ startEntry = await import("#tanstack-start-entry"); ╵ ~~~~~~~~~~~~~~~~~~~~~~~ The package import "#tanstack-start-entry" is not defined in this "imports" map: node_modules/@tanstack/start-server-core/package.json:49:13: 49 │ "imports": { ╵ ^ You can mark the path "#tanstack-start-entry" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle. You can also add ".catch()" here to handle this failure at run-time instead of bundle-time. ✘ [ERROR] Could not resolve "tanstack-start-manifest:v" node_modules/@tanstack/start-server-core/dist/esm/router-manifest.js:3:44: 3 │ ...t { tsrStartManifest } = await import("tanstack-start-manifest:v"); ╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ You can mark the path "tanstack-start-manifest:v" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle. You can also add ".catch()" here to handle this failure at run-time instead of bundle-time. ✘ [ERROR] Could not resolve "tanstack-start-injected-head-scripts:v" node_modules/@tanstack/start-server-core/dist/esm/router-manifest.js:9:49: 9 │ ...Scripts } = await import("tanstack-start-injected-head-scripts:v"); ╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ You can mark the path "tanstack-start-injected-head-scripts:v" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle. You can also add ".catch()" here to handle this failure at run-time instead of bundle-time. ``` ### What version of Better Auth are you using? ^1.4.3 ### System info ```bash { "system": { "platform": "darwin", "arch": "arm64", "version": "Darwin Kernel Version 25.1.0: Mon Oct 20 19:32:41 PDT 2025; root:xnu-12377.41.6~2/RELEASE_ARM64_T6000", "release": "25.1.0", "cpuCount": 10, "cpuModel": "Apple M1 Max", "totalMemory": "32.00 GB", "freeMemory": "3.06 GB" }, "node": { "version": "v22.21.0", "env": "development" }, "packageManager": { "name": "bun", "version": "1.3.3" }, "frameworks": [ { "name": "react", "version": "^19.2.0" } ], "databases": [ { "name": "pg", "version": "^8.16.3" }, { "name": "drizzle", "version": "^0.44.7" } ], "betterAuth": { "version": "^1.4.3", "config": null } } ``` ### Which area(s) are affected? (Select all that apply) Backend ### Auth config (if applicable) ```typescript import { passkey } from "@better-auth/passkey"; import { BetterAuthError, betterAuth } from "better-auth"; import { drizzleAdapter } from "better-auth/adapters/drizzle"; import { type GenericOAuthConfig, genericOAuth, twoFactor } from "better-auth/plugins"; import { username } from "better-auth/plugins/username"; import { tanstackStartCookies } from "better-auth/tanstack-start"; import { db } from "@/integrations/drizzle/client"; import { env } from "@/utils/env"; import { generateId, toUsername } from "@/utils/string"; import { schema } from "../drizzle"; function isCustomOAuthProviderEnabled() { return ( env.OAUTH_CLIENT_ID && env.OAUTH_CLIENT_SECRET && env.OAUTH_DISCOVERY_URL && env.OAUTH_AUTHORIZATION_URL && env.OAUTH_REDIRECT_URI ); } const getAuthConfig = () => { const authConfigs: GenericOAuthConfig[] = []; if (isCustomOAuthProviderEnabled()) { authConfigs.push({ providerId: "custom", clientId: env.OAUTH_CLIENT_ID as string, clientSecret: env.OAUTH_CLIENT_SECRET, discoveryUrl: env.OAUTH_DISCOVERY_URL, authorizationUrl: env.OAUTH_AUTHORIZATION_URL, redirectURI: env.OAUTH_REDIRECT_URI, mapProfileToUser: async (profile) => { if (!profile.email) { throw new BetterAuthError( "OAuth Provider did not return an email address. This is required for user creation.", "EMAIL_REQUIRED", ); } const email = profile.email; const name = profile.name ?? profile.preferred_username ?? email.split("@")[0]; const username = profile.preferred_username ?? email.split("@")[0]; const image = profile.image ?? profile.picture ?? profile.avatar_url; return { name, email, image, username, displayUsername: username, emailVerified: true, }; }, } satisfies GenericOAuthConfig); } return betterAuth({ appName: "REDACTED", secret: env.AUTH_SECRET, database: drizzleAdapter(db, { schema, provider: "pg" }), telemetry: { enabled: false }, advanced: { database: { generateId }, useSecureCookies: env.APP_URL.startsWith("https://"), }, emailAndPassword: { enabled: true, autoSignIn: true, minPasswordLength: 6, maxPasswordLength: 64, requireEmailVerification: false, disableSignUp: env.FLAG_DISABLE_SIGNUP, sendResetPassword: async ({ user, url }) => { console.log(`[EMAIL] [${user.email}] To reset your password, please visit the following URL: ${url}`); }, password: { hash: (password) => Bun.password.hash(password), verify: ({ password, hash }) => Bun.password.verify(password, hash), }, }, emailVerification: { sendOnSignUp: true, autoSignInAfterVerification: true, sendVerificationEmail: async ({ user, url }) => { console.log(`[EMAIL] [${user.email}] To verify your email, please visit the following URL: ${url}`); }, }, user: { changeEmail: { enabled: true, sendChangeEmailVerification: async ({ user, newEmail, url }) => { console.log( `[EMAIL] [${user.email}] To change your email to ${newEmail}, please visit the following URL: ${url}`, ); }, }, additionalFields: { username: { type: "string", required: true, }, }, }, socialProviders: { google: { enabled: !!env.GOOGLE_CLIENT_ID && !!env.GOOGLE_CLIENT_SECRET, // biome-ignore lint/style/noNonNullAssertion: enabled check ensures these are not null clientId: env.GOOGLE_CLIENT_ID!, // biome-ignore lint/style/noNonNullAssertion: enabled check ensures these are not null clientSecret: env.GOOGLE_CLIENT_SECRET!, mapProfileToUser: async (profile) => { return { name: profile.name, email: profile.email, image: profile.picture, username: profile.email.split("@")[0], displayUsername: profile.email.split("@")[0], emailVerified: true, }; }, }, github: { enabled: !!env.GITHUB_CLIENT_ID && !!env.GITHUB_CLIENT_SECRET, // biome-ignore lint/style/noNonNullAssertion: enabled check ensures these are not null clientId: env.GITHUB_CLIENT_ID!, // biome-ignore lint/style/noNonNullAssertion: enabled check ensures these are not null clientSecret: env.GITHUB_CLIENT_SECRET!, mapProfileToUser: async (profile) => { return { name: profile.name, email: profile.email, image: profile.avatar_url, username: profile.login, displayUsername: profile.login, emailVerified: true, }; }, }, }, plugins: [ username({ minUsernameLength: 3, maxUsernameLength: 64, usernameNormalization: (value) => toUsername(value), displayUsernameNormalization: (value) => toUsername(value), validationOrder: { username: "post-normalization", displayUsername: "post-normalization" }, }), twoFactor({ issuer: "REDACTED" }), passkey({ rpName: "REDACTED", rpID: "localhost" }), genericOAuth({ config: authConfigs }), tanstackStartCookies(), ], }); }; export const auth = getAuthConfig(); ``` ### Additional context _No response_
GiteaMirror added the locked label 2026-04-13 06:40:14 -05:00
Author
Owner

@better-auth-agent[bot] commented on GitHub (Nov 26, 2025):

Hi there, thanks for submitting this issue! It looks like the error arises because the bundler (in your case Bun) isn’t able to resolve the special module paths (such as "#tanstack-router-entry", "#tanstack-start-entry", "tanstack-start-manifest:v", and "tanstack-start-injected-head-scripts:v") that TanStack Start uses internally. These paths aren't defined in the imports map, which is why the error suggests marking them as external or handling the failure at runtime.

A few steps you might try:
• Adjust your bundler configuration to mark these paths as external. For Bun, this could involve adding proper alias settings or externalizing these modules so they are left unresolved during bundling.
• Double-check that your versions of TanStack Start and Better Auth (^1.4.3) are compatible and that any required TanStack Start configurations (like an up-to-date import map) are properly set.
• Consult the TanStack Start documentation to see if there are additional build setup steps for when using Bun as the bundler.

Do these steps help move things forward on your end? Tag @better-auth-agent if you would like an answer from the Agent.

DiagramDiscordGitHub

Diagram Join Star

<!-- gh-comment-id:3583399600 --> @better-auth-agent[bot] commented on GitHub (Nov 26, 2025): Hi there, thanks for submitting this issue! It looks like the error arises because the bundler (in your case Bun) isn’t able to resolve the special module paths (such as "#tanstack-router-entry", "#tanstack-start-entry", "tanstack-start-manifest:v", and "tanstack-start-injected-head-scripts:v") that TanStack Start uses internally. These paths aren't defined in the imports map, which is why the error suggests marking them as external or handling the failure at runtime. A few steps you might try: • Adjust your bundler configuration to mark these paths as external. For Bun, this could involve adding proper alias settings or externalizing these modules so they are left unresolved during bundling. • Double-check that your versions of TanStack Start and Better Auth (^1.4.3) are compatible and that any required TanStack Start configurations (like an up-to-date import map) are properly set. • Consult the TanStack Start documentation to see if there are additional build setup steps for when using Bun as the bundler. Do these steps help move things forward on your end? Tag @better-auth-agent if you would like an answer from the Agent. <!-- bot:webhook reply v1 --> [Diagram](https://repodiagrams.s3.eu-north-1.amazonaws.com/better-auth_ultra_detailed_interactive.html) • [Discord](https://discord.gg/better-auth) • [GitHub](https://github.com/better-auth/better-auth) [![Diagram](https://img.shields.io/badge/Diagram-2b3137?style=flat-square)](https://repodiagrams.s3.eu-north-1.amazonaws.com/better-auth_ultra_detailed_interactive.html) [![Join](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&style=flat-square)](https://discord.gg/better-auth) [![Star](https://img.shields.io/badge/star-181717?logo=github&logoColor=white&style=flat-square)](https://github.com/better-auth/better-auth)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#10489