T
TanStack2mo ago
other-emerald

"Attempted to assign to readonly property" at vite build?

In a bun-driven project, set at Tanstack Start, Router 1.121.41 and react-query 5.80.47, after a reset deleting node_modules, bun.lock and then installing again, when running bunx --bun vite build (which has worked fine since 5 weeks ago) I get this error below. Also tried with npm, npx and so on. Anyone else seen something similar or have some pointers on this problem that I believe involves packaging? I finally went back to a 5 days old project version (full folder) and this worked as expected until the reset, install and build, so appears to be out of my hands, except I might've missed updating my configurations. error during build: Attempted to assign to readonly property. at push (unknown) at getLiteralValueAtPath (/path/to/app/node_modules/rollup/dist/es/shared/node-entry.js:12270:45) at withTrackedEntityAtPath (/path/to/app/node_modules/rollup/dist/es/shared/node-entry.js:2014:24) …
6 Replies
fair-rose
fair-rose2mo ago
does this also occur when using node instead of bun?
other-emerald
other-emeraldOP2mo ago
No, there's a different error for either, or both, of npx tsc --build && npx vite build: "Exit prior to config file resolving cause call config.load() before reading values" though just tsc --build works. If I try ./node_modules/vite/bin/vite.js build I get this "error during build: Cannot add property 0, object is not extensible at Array.push (<anonymous>) at ConditionalExpression.getLiteralValueAtPath (file:///path/to/app/node_modules/rollup/dist/es/shared/node-entry.js:12270:45) at file:///path/to/app/node_modules/rollup/dist/es/shared/node-entry.js:5064:30 at EntityPathTracker.withTrackedEntityAtPath (file:///path/to/app/node_modules/rollup/dist/es/shared/node-entry.js:2014:24) at LocalVariable.getLiteralValueAtPath (file:///path/to/app/node_modules/rollup/dist/es/shared/node-entry.js:5062:33) at Identifier.getLiteralValueAtPath (file:///path/to/app/node_modules/rollup/dist/es/shared/node-entry.js:5207:48) at MemberExpression.getDynamicPropertyKey (file:///path/to/app/node_modules/rollup/dist/es/shared/node-entry.js:7636:41) at MemberExpression.hasAccessEffect (file:///path/to/app/node_modules/rollup/dist/es/shared/node-entry.js:7652:65) at MemberExpression.hasEffects (file:///path/to/app/node_modules/rollup/dist/es/shared/node-entry.js:7433:18) at AssignmentExpression.hasEffects (file:///path/to/app/node_modules/rollup/dist/es/shared/node-entry.js:11567:23)"+
other-emerald
other-emeraldOP2mo ago
I have removed the build error for now by commenting out ReactQueryDevtools in my __root (still under development), though I'm not sure that's the whole story. I'll see. In this process of finding the issue I also updated to v1.121.7, which made no difference.
fair-rose
fair-rose2mo ago
can you please create a github issue including a complete example project so we can properly track this?
passive-yellow
passive-yellow2mo ago
other-emerald
other-emeraldOP2mo ago
Thank you. I took your advice in the thread and specifically added rollup 4.44.2 as a devDependency as well as overriding it (just to make sure). I verified with bun pm ls --all |grep rollup Build Error is gone from vite build. Unfortunately, so is both ReactQueryDevtools as well as TanStackRouterDevtools, so I'll have to find out in a new test project what might work or not in an illustrative way. This means the downgrade of rollup, in my case, was tantamount to removing ReactQueryDevtools. Hopefully this is fixable. I'll post any results later. I have now reverted the project to a previous commit and instead tried the treeshake: false suggestion, from stofbergsean (see hiogawa's link), in build.rollupOptions. Also this alone, post next vite build, immediately removes both ReactQueryDevtools and TanStackRouterDevtools from my pages. This means the matter is unresolved for now. I'll investigate more later. Thanks for the responses! Adding that I just tried rollup 4.45.1, by overriding, the build error doesn't occur also without disabling treeshake, but neither of my devtools are back. This might be its own problem for me. As the build error is gone, so is the focus for this thread. Thanks everyone! You were very helpful.

Did you find this page helpful?