Skip to content

Commit

Permalink
Fix ESM_PROJECT_WITHOUT_CJS_CONFIG heuristic
Browse files Browse the repository at this point in the history
  • Loading branch information
fvictorio authored and kanej committed Jan 20, 2025
1 parent 441afcc commit 1ab9afa
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export function importCsjOrEsModule(filePath: string): any {
const imported = require(filePath);
return imported.default !== undefined ? imported.default : imported;
} catch (e: any) {
if (e.code === "ERR_REQUIRE_ESM") {
if (e.code === "ERR_REQUIRE_ESM" || e.message === "module is not defined" || e.message === "require is not defined") {
throw new HardhatError(
ERRORS.GENERAL.ESM_PROJECT_WITHOUT_CJS_CONFIG,
{},
Expand Down

0 comments on commit 1ab9afa

Please sign in to comment.