How configure fs in the next.config.js? I want yo use the function readdir but i receive an error

Viewed 87

TypeError: fs__WEBPACK_IMPORTED_MODULE_0___default.a.readdir is not a function

The code is this:

import fs from 'fs'

const CapNum = fs.readdir( "./folder", (error, files) => { 
    let totalFiles = files.length;
    // return the number of files
    console.log(totalFiles)
    return(totalFiles); // print the total number of files
});

export default CapNum
0 Answers
Related