Error [ERR_REQUIRE_ESM]: require() of ES Module

I've setup an frontend repository with twing as template engine. The repo has an package.json with

"type": "module",

The repo is a setup with koa.js, esbuild and twing. In the node environment (node 16/mac osx) we use esm or es6 in all the node js files for the server. 1 thing is not working and that is the caching for twing. I wanna use this for production.

My code is

const twing = new TwingEnvironment(loader, {
  cache: config.get('TWING_ENVIRONMENT_CACHE'),
  debug: config.get('TWING_ENVIRONMENT_DEBUG'),
  auto_reload: config.get('TWING_ENVIRONMENT_AUTO_RELOAD'),
  strict_variables: config.get('TWING_ENVIRONMENT_STRICT_VARIABLES'),
  optimizations: config.get('TWING_ENVIRONMENT_OPTIMIZATIONS'),
});

and config.get('TWING_ENVIRONMENT_CACHE') is an absolute path "./sources/app/views/.cache"

My error when I access the page, is:

Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/****/Sites/****/frontend-service/frameworks/****-fe-framework/sources/app/views/.cache/d9/d9c265249eaa8c809a323c684b623ba45f8b67b119ef9fd45c03fcf9aad5f6d9.js from /Users/****/Sites/****/frontend-service/frameworks/****-fe-framework/node_modules/twing/dist/cjs/lib/cache/filesystem.js not supported.
d9c265249eaa8c809a323c684b623ba45f8b67b119ef9fd45c03fcf9aad5f6d9.js is treated as an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which declares all .js files in that package scope as ES modules.
Instead rename d9c265249eaa8c809a323c684b623ba45f8b67b119ef9fd45c03fcf9aad5f6d9.js to end in .cjs, change the requiring code to use dynamic import() which is available in all CommonJS modules, or change "type": "module" to "type": "commonjs" in /Users/****/Sites/****/frontend-service/frameworks/****-fe-framework/package.json to treat all .js files as CommonJS (using .mjs for all ES modules instead).

    at /Users/****/Sites/****/frontend-service/frameworks/****-fe-framework/node_modules/twing/dist/cjs/lib/cache/filesystem.js:36:29
    at FSReqCallback.oncomplete (node:fs:199:5) {
  code: 'ERR_REQUIRE_ESM'
}

How can I fix this...?