Skip to content
Discussion options

You must be logged in to vote

You're running into two separate issues: the Node.js API error and the loss of Tailwind styling. Here’s how to address both:

1. Fixing the "createRequire is not a function" error:

  • This error means server-only code (like better-auth) is leaking into your browser bundle. To prevent this, you need to alias all server-only modules to pure ESM mock files that export stubs or empty objects—no Node.js APIs or side effects.

  • Place mocks for external packages (like better-auth) in a root __mocks__ directory (at your project root, next to .storybook). For example, create __mocks__/better-auth.js (must be .js and ESM, not TypeScript or CJS):

    // __mocks__/better-auth.js
    export const someAuthFunction

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@SanguineTitan57
Comment options

@dosubot
Comment options

@SanguineTitan57
Comment options

@dosubot
Comment options

Answer selected by SanguineTitan57
@SanguineTitan57
Comment options

@dosubot
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
1 participant