Skip to content
Discussion options

You must be logged in to vote

@booherbg this is caused by vite 7's switch from esbuild to rolldown for dependency pre-bundling. the stack trace format changed, breaking zustand's action name detection.

in devtools.ts (~line 176), zustand extracts action names by parsing new Error().stack:

const findCallerName = (stack: string | undefined) => {
  const traceLines = stack.split('\n')
  const idx = traceLines.findIndex((l) => l.includes('api.setState'))
  const callerLine = traceLines[idx + 1]?.trim() || ''
  return /.+ (.+) .+/.exec(callerLine)?.[1]
}

rolldown produces different wrapper function names and source map alignment than esbuild, so the regex fails and falls through to 'anonymous'. @dai-shi's reference to #3250

Replies: 4 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@booherbg
Comment options

@dbritto-dev
Comment options

Answer selected by booherbg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants