I am facing an issue while trying to separate route directories in my project. The error I encountered is as follows:
rror [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './cjs' is not defined by "exports" in /mnt/.../projects/.../nanoexpress/node_modules/nanoexpress/package.json
app.js
const nanoexpress = require('nanoexpress');
var indexRouter = require('./routes/index');
const app = nanoexpress();
const port = 3333;
app.get('/', (req, res) => {
res.send('Hello World!')
})
app.use('/testy',indexRouter)
app.listen(port)
routers/inde.js
const nanoexpress = require('nanoexpress/cjs');
const Route = require('nanoexpress/cjs/Route');
const app = nanoexpress();
const testRoute = new Route();
testRoute.get('/route', async () => 'hello');
module.exports.testRoute = testRoute;