I am new to typescript and React, I am trying to load all files in array,
const path = require('path'); const fs = require('fs'); const directoryPath = path.join("/checking/"); if (!fs.existsSync(directoryPath)) { console.log('good') }
This shows error in Browser Console-
Uncaught TypeError: fs.existsSync is not a function at startEditor1 (main.chunk.js:25202) at onClick (main.chunk.js:25377) at onClickHandler (main.chunk.js:16866) at HTMLUnknownElement.callCallback (vendors~main.chunk.js:140757) at Object.invokeGuardedCallbackDev (vendors~main.chunk.js:140806) at invokeGuardedCallback (vendors~main.chunk.js:140860) at invokeGuardedCallbackAndCatchFirstError (vendors~main.chunk.js:140875) at executeDispatch (vendors~main.chunk.js:141181) at executeDispatchesInOrder (vendors~main.chunk.js:141206) at executeDispatchesAndRelease (vendors~main.chunk.js:141305) at executeDispatchesAndReleaseTopLevel (vendors~main.chunk.js:141314) at forEachAccumulated (vendors~main.chunk.js:141286) at runEventsInBatch (vendors~main.chunk.js:141454) at runExtractedEventsInBatch (vendors~main.chunk.js:141462) at handleTopLevel (vendors~main.chunk.js:145639) at batchedUpdates$1 (vendors~main.chunk.js:162073) at batchedUpdates (vendors~main.chunk.js:142857) at dispatchEvent (vendors~main.chunk.js:145719) at vendors~main.chunk.js:162130 at Object.unstable_runWithPriority (vendors~main.chunk.js:179596) at interactiveUpdates$1 (vendors~main.chunk.js:162129) at interactiveUpdates (vendors~main.chunk.js:142878) at dispatchInteractiveEvent (vendors~main.chunk.js:145695)
How to solve this error, thanks