Skip to content

Commit 395700e

Browse files
committed
fix: import a package module with "exports" causing "Cannot not find module"
1 parent c27f297 commit 395700e

5 files changed

+22
-8
lines changed

lib/load-parser-config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { dirname } from "node:path";
22
import { fileURLToPath } from "node:url";
3-
import importFrom from "import-from-esm";
3+
import importFrom from "import-from";
44
import conventionalChangelogAngular from "conventional-changelog-angular";
55

66
/**

lib/load-release-rules.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { dirname } from "node:path";
22
import { fileURLToPath } from "node:url";
33
import { isUndefined } from "lodash-es";
4-
import importFrom from "import-from-esm";
4+
import importFrom from "import-from";
55
import RELEASE_TYPES from "./default-release-types.js";
66

77
/**

package-lock.json

Lines changed: 14 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"conventional-commits-filter": "^4.0.0",
2222
"conventional-commits-parser": "^5.0.0",
2323
"debug": "^4.0.0",
24-
"import-from-esm": "^1.0.3",
24+
"import-from": "^4.0.0",
2525
"lodash-es": "^4.17.21",
2626
"micromatch": "^4.0.2"
2727
},

test/load-parser-config.test.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import test from "ava";
2-
import importFrom from "import-from-esm";
2+
import importFrom from "import-from";
33
import sinon from "sinon";
44
import loadParserConfig from "../lib/load-parser-config.js";
55

@@ -92,12 +92,13 @@ test(loadPreset, "express");
9292
test(loadConfig, "express");
9393
test(loadPreset, "jshint");
9494
test(loadConfig, "jshint");
95-
test(loadConfig, "techor");
9695
test(loadPreset, "conventionalcommits", { presetConfig: {} });
9796
test(loadConfig, "conventionalcommits", { presetConfig: {} });
9897

99-
test('Throw error if "config" doesn`t exist', async (t) => {
100-
await t.throwsAsync(loadParserConfig({ config: "unknown-config" }, { cwd }), { code: "MODULE_NOT_FOUND" });
98+
test('Throw error if "config" is not a function', async (t) => {
99+
await t.throwsAsync(loadPreset(t, "techor"), {
100+
message: "((intermediate value) || (intermediate value)) is not a function",
101+
});
101102
});
102103

103104
test('Throw error if "preset" doesn`t exist', async (t) => {

0 commit comments

Comments
 (0)