[GH-ISSUE #1211] [v1.1.12] Crash in SvelteKit. Could not resolve "nanostores" #25967

Closed
opened 2026-04-17 16:18:38 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @oskar-gmerek on GitHub (Jan 14, 2025).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/1211

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

Update to BA 1.1.12 and after bun dev app will crash with error that could not resolve "nanostores".

Current vs. Expected behavior

 [ERROR] Could not resolve "nanostores"

    node_modules/better-auth/dist/client/plugins.js:11:21:
      11  import { atom } from 'nanostores';
                               ~~~~~~~~~~~~

  You can mark the path "nanostores" as external to exclude it from the bundle, which will remove
  this error and leave the unresolved path in the bundle.

 [ERROR] Could not resolve "nanostores"

    node_modules/better-auth/dist/chunk-PAQJNMGG.js:4:30:
      4  import { atom, onMount } from 'nanostores';
                                       ~~~~~~~~~~~~

  You can mark the path "nanostores" as external to exclude it from the bundle, which will remove
  this error and leave the unresolved path in the bundle.

 [ERROR] Could not resolve "nanostores"

    node_modules/better-auth/dist/chunk-URPHRM5F.js:3:21:
      3  import { atom } from 'nanostores';
                              ~~~~~~~~~~~~

  You can mark the path "nanostores" as external to exclude it from the bundle, which will remove
  this error and leave the unresolved path in the bundle.

𝓲 Loaded master.css.ts
/Users/user/Desktop/app/node_modules/esbuild/lib/main.js:1476
  let error = new Error(text);
              ^

Error: Build failed with 3 errors:
node_modules/better-auth/dist/chunk-PAQJNMGG.js:4:30: ERROR: Could not resolve "nanostores"
node_modules/better-auth/dist/chunk-URPHRM5F.js:3:21: ERROR: Could not resolve "nanostores"
node_modules/better-auth/dist/client/plugins.js:11:21: ERROR: Could not resolve "nanostores"
    at failureErrorWithLog (/Users/user/Desktop/app/node_modules/esbuild/lib/main.js:1476:15)
    at /Users/user/Desktop/app/node_modules/esbuild/lib/main.js:945:25
    at /Users/user/Desktop/app/node_modules/esbuild/lib/main.js:1354:9
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5) {
  errors: [Getter/Setter],
  warnings: [Getter/Setter]
}

What version of Better Auth are you using?

1.1.12

Provide environment information

- OS: macOS M1 15.2
- Bun 1.1.43
- SvelteKit 2.15.2

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

Backend, Client, Package

Auth config (if applicable)

import { betterAuth } from "better-auth"
export const auth = betterAuth({
  trustedOrigins: env.ALLOWED_ORIGINS?.split(",") || [],
  database: surrealAdapter(db),
  secret: env.BETTER_AUTH_SECRET,
  appName: env.APP_NAME,
  emailAndPassword: {  
    enabled: true
  },
});

Additional context

Downgrading the version to 1.1.11 makes the application work properly again.

Originally created by @oskar-gmerek on GitHub (Jan 14, 2025). Original GitHub issue: https://github.com/better-auth/better-auth/issues/1211 ### Is this suited for github? - [X] Yes, this is suited for github ### To Reproduce Update to BA 1.1.12 and after `bun dev` app will crash with error that could not resolve "nanostores". ### Current vs. Expected behavior ```ts ✘ [ERROR] Could not resolve "nanostores" node_modules/better-auth/dist/client/plugins.js:11:21: 11 │ import { atom } from 'nanostores'; ╵ ~~~~~~~~~~~~ You can mark the path "nanostores" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle. ✘ [ERROR] Could not resolve "nanostores" node_modules/better-auth/dist/chunk-PAQJNMGG.js:4:30: 4 │ import { atom, onMount } from 'nanostores'; ╵ ~~~~~~~~~~~~ You can mark the path "nanostores" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle. ✘ [ERROR] Could not resolve "nanostores" node_modules/better-auth/dist/chunk-URPHRM5F.js:3:21: 3 │ import { atom } from 'nanostores'; ╵ ~~~~~~~~~~~~ You can mark the path "nanostores" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle. 𝓲 Loaded master.css.ts /Users/user/Desktop/app/node_modules/esbuild/lib/main.js:1476 let error = new Error(text); ^ Error: Build failed with 3 errors: node_modules/better-auth/dist/chunk-PAQJNMGG.js:4:30: ERROR: Could not resolve "nanostores" node_modules/better-auth/dist/chunk-URPHRM5F.js:3:21: ERROR: Could not resolve "nanostores" node_modules/better-auth/dist/client/plugins.js:11:21: ERROR: Could not resolve "nanostores" at failureErrorWithLog (/Users/user/Desktop/app/node_modules/esbuild/lib/main.js:1476:15) at /Users/user/Desktop/app/node_modules/esbuild/lib/main.js:945:25 at /Users/user/Desktop/app/node_modules/esbuild/lib/main.js:1354:9 at process.processTicksAndRejections (node:internal/process/task_queues:105:5) { errors: [Getter/Setter], warnings: [Getter/Setter] } ``` ### What version of Better Auth are you using? 1.1.12 ### Provide environment information ```bash - OS: macOS M1 15.2 - Bun 1.1.43 - SvelteKit 2.15.2 ``` ### Which area(s) are affected? (Select all that apply) Backend, Client, Package ### Auth config (if applicable) ```typescript import { betterAuth } from "better-auth" export const auth = betterAuth({ trustedOrigins: env.ALLOWED_ORIGINS?.split(",") || [], database: surrealAdapter(db), secret: env.BETTER_AUTH_SECRET, appName: env.APP_NAME, emailAndPassword: { enabled: true }, }); ``` ### Additional context Downgrading the version to 1.1.11 makes the application work properly again.
GiteaMirror added the lockedbug labels 2026-04-17 16:18:38 -05:00
Author
Owner

@Bekacru commented on GitHub (Jan 14, 2025):

should be fixed on 1.1.13-beta.2

<!-- gh-comment-id:2590736357 --> @Bekacru commented on GitHub (Jan 14, 2025): should be fixed on `1.1.13-beta.2`
Author
Owner

@oskar-gmerek commented on GitHub (Jan 14, 2025):

Yeah, works fine on 1.1.13. Thanks for fast fix!

<!-- gh-comment-id:2590946580 --> @oskar-gmerek commented on GitHub (Jan 14, 2025): Yeah, works fine on `1.1.13`. Thanks for fast fix!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#25967