Skip to content

Commit

Permalink
fix(get-config): loaded config with require rather than import
Browse files Browse the repository at this point in the history
since loading json config cannot be accomplished with import without import assertions

for #2543
  • Loading branch information
travi committed Nov 4, 2022
1 parent 6005f8c commit 75c6750
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions 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';
Expand All @@ -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';

Expand All @@ -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
Expand Down

0 comments on commit 75c6750

Please sign in to comment.