Hi all,
After upgrading to Vite 8, we're seeing the following build-time error:
[ILLEGAL_REASSIGNMENT] Error: Unexpected re-assignment of const variable storagePtr
It appears in JS code generated by jco, for example:
function _liftFlatRecord(keysAndLiftFns) {
return function _liftFlatRecordInner(ctx) {
_debugLog('[_liftFlatRecord()] args', { ctx });
const { memory, useDirectParams, storagePtr, storageLen, params } = ctx;
if (useDirectParams) {
storagePtr = params[0]; // <-- re-assignment causes ILLEGAL_REASSIGNMENT
}
Dev mode works fine, but production build fails. Has anyone encountered this before, or have suggestions for handling const reassignment in generated code?
As a workaround, changing the destructured binding from const to let avoids the error.
jco 1.16.1 also generates the same code, but vite 7.3.1 does not report an error.
The issue becomes visible when using jco 1.17.0.
Thanks for the report @ktz_alias ! Will have a bug fix release out soon
OK new version of Jco is out -- 1.17.1, please let me know if you still run into this -- should be fixed
@ktz_alias would you mind re-checking this one too? I think you should be good now
Last updated: Mar 23 2026 at 16:19 UTC