diff --git a/lib/get-config.js b/lib/get-config.js index 3f0736167c..873e48c2b7 100644 --- a/lib/get-config.js +++ b/lib/get-config.js @@ -1,5 +1,6 @@ -import {dirname} from 'node:path'; +import {dirname, resolve} from 'node:path'; import {fileURLToPath} from 'node:url'; +import {createRequire} from 'node:module'; import {castArray, isNil, isPlainObject, isString, pickBy} from 'lodash-es'; import {readPackageUp} from 'read-pkg-up'; @@ -13,6 +14,7 @@ import {parseConfig, validatePlugin} from './plugins/utils.js'; const debug = debugConfig('semantic-release:config'); const __dirname = dirname(fileURLToPath(import.meta.url)); +const require = createRequire(import.meta.url); const CONFIG_NAME = 'release'; @@ -33,7 +35,7 @@ export default async (context, cliOptions) => { options = { ...castArray(extendPaths).reduce(async(eventualResult, extendPath) => { const result = await eventualResult; - const extendsOptions = await import(resolveFrom.silent(__dirname, extendPath) || resolveFrom(cwd, extendPath)); + const extendsOptions = require(resolveFrom.silent(__dirname, extendPath) || resolveFrom(cwd, extendPath)); // For each plugin defined in a shareable config, save in `pluginsPath` the extendable config path, // so those plugin will be loaded relative to the config file