How to resolve error "Must use import to load ES Module" with karma

Viewed 384

Our project has "type": "module" in the package.json file and the test runner is invoked using karma start ./src/tests/config/karma.conf.main.js but it reports the following error when ran:

Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /Users/me/git/project/src/tests/config/karma.conf.main.js

The contents of the karma.conf.main.js is a minimal as it can possibly be:

import './karma.conf.common';
0 Answers
Related