...and using a ".importjs.js" file, then this error happens
Unable to parse configuration file. Reason:
Error [ERR_REQUIRE_ESM]: require() of ES Module /home/mika/mikabytes/cabinroad/app/public/.importjs.js from /home/mika/.nvm/versions/node/v20.10.0/lib/node_modules/import-js/build/FileUtils.js not supported.
.importjs.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 either rename .importjs.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 /home/mika/mikabytes/cabinroad/app/package.json to treat all .js files as CommonJS (using .mjs for all ES modules instead).
at Object.readJsFile (/home/mika/.nvm/versions/node/v20.10.0/lib/node_modules/import-js/build/FileUtils.js:35:12)
at Configuration.loadUserConfig (/home/mika/.nvm/versions/node/v20.10.0/lib/node_modules/importjs/build/Configuration.js:271:44)
at new Configuration (/home/mika/.nvm/versions/node/v20.10.0/lib/node_modules/import-js/build/Configuration.js:209:25)
at new Importer (/home/mika/.nvm/versions/node/v20.10.0/lib/node_modules/import-js/build/Importer.js:96:19)
at Interface.<anonymous> (/home/mika/.nvm/versions/node/v20.10.0/lib/node_modules/import-js/build/daemon.js:65:20)
However, the proposed solution in the error message to rename the file to .importjs.cjs won't work, because importjs doesn't look for that file (or the related .importjs.mjs one).
In a project with a package.json that specifies
...and using a ".importjs.js" file, then this error happens
However, the proposed solution in the error message to rename the file to
.importjs.cjs
won't work, because importjs doesn't look for that file (or the related .importjs.mjs one).I'll try to fix this and submit a PR shortly