I have set up a vite app, using the react-ts
template. I’ve been using the npm run dev
script all this time, but now I’ve tried to actually build it.
So, using npm run build
, typescript throws an error which I really don’t understand – the stacktrace doesn’t point to any of my files or functions and I’m somewhat sure typescript itself isn’t broken.
I’ve also searched my entire codebase for calls to push
and there are only 4, all perfectly valid and executed on an initialized constant. The code itself is working fine – as it has all this time using the dev server. I just can’t build it into production output.
Stacktrace:
TypeError: Cannot read properties of undefined (reading 'push')
at addLazyProgramDiagnosticExplainingFile (F:...node_modulestypescriptlibtsc.js:121723:41)
at checkSourceFilesBelongToPath (F:...node_modulestypescriptlibtsc.js:121142:11)
at F:...node_modulestypescriptlibtsc.js:119558:37
at getCommonSourceDirectory (F:...node_modulestypescriptlibtsc.js:112926:53)
at Object.getCommonSourceDirectory2 [as getCommonSourceDirectory] (F:...node_modulestypescriptlibtsc.js:119553:31)
at getDeclarationEmitOutputFilePath (F:...node_modulestypescriptlibtsc.js:16089:119)
at getOutputPathsFor (F:...node_modulestypescriptlibtsc.js:112841:96)
at forEachEmittedFile (F:...node_modulestypescriptlibtsc.js:112786:31)
at emitFiles (F:...node_modulestypescriptlibtsc.js:112992:3)
at F:...node_modulestypescriptlibtsc.js:120047:13