mirror of
https://github.com/svg/svgo.git
synced 2025-07-29 20:21:14 +03:00
This commit is contained in:
@ -2,13 +2,15 @@ import os from 'os';
|
|||||||
import fs from 'fs/promises';
|
import fs from 'fs/promises';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import * as svgo from './svgo.js';
|
import * as svgo from './svgo.js';
|
||||||
|
import url from 'url';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} configFile
|
* @param {string} configFile
|
||||||
* @returns {Promise<import('./types.js').Config>}
|
* @returns {Promise<import('./types.js').Config>}
|
||||||
*/
|
*/
|
||||||
const importConfig = async (configFile) => {
|
const importConfig = async (configFile) => {
|
||||||
const imported = await import(path.resolve(configFile));
|
const resolvedPath = path.resolve(configFile);
|
||||||
|
const imported = await import(url.pathToFileURL(resolvedPath).toString());
|
||||||
const config = imported.default;
|
const config = imported.default;
|
||||||
|
|
||||||
if (config == null || typeof config !== 'object' || Array.isArray(config)) {
|
if (config == null || typeof config !== 'object' || Array.isArray(config)) {
|
||||||
|
Reference in New Issue
Block a user