Error: ENOENT: no such file or directory, lstat '<project-path>/pages/api'
at Object.realpathSync (node:fs:2486:7)
at _walkSync (<project-path>/node_modules/walk-sync/index.js:109:25)
at Object.walkSync [as default] (<project-path>/node_modules/walk-sync/index.js:20:12)
at Object.generateTypeScriptFile (<project-path>/node_modules/next-type-safe-routes/dist/plugin/generateTypeScriptFile/generateTypeScriptFile.js:19:44)
at writeTypesToDisc (<project-path>/node_modules/next-type-safe-routes/dist/plugin/index.js:20:58)
at Object.webpack (<project-path>/node_modules/next-type-safe-routes/dist/plugin/index.js:36:13)
at Object.getBaseWebpackConfig [as default] (<project-path>/node_modules/next/dist/build/webpack-config.js:1364:32)
at async Promise.all (index 0)
at async Span.traceAsyncFn (<project-path>/node_modules/next/dist/trace/trace.js:74:20)
at async Span.traceAsyncFn (<project-path>/node_modules/next/dist/trace/trace.js:74:20) {
errno: -2,
syscall: 'lstat',
code: 'ENOENT',
path: '<project-path>/pages/api'
}
Expected behavior
Since API routes are optional in Next, I don't think it should fail upon their absence.
Build fails with following message
Expected behavior
Since API routes are optional in Next, I don't think it should fail upon their absence.