1
0
mirror of https://github.com/svg/svgo.git synced 2025-07-28 09:22:00 +03:00

fix(#2140): SVGO fails with ERR_UNSUPPORTED_ESM_URL_SCHEME on Windows (#2141)

This commit is contained in:
Lorfdail
2025-06-09 23:18:29 +02:00
committed by GitHub
parent 25820964ad
commit cb3eea80ba

View File

@ -2,13 +2,15 @@ import os from 'os';
import fs from 'fs/promises';
import path from 'path';
import * as svgo from './svgo.js';
import url from 'url';
/**
* @param {string} configFile
* @returns {Promise<import('./types.js').Config>}
*/
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;
if (config == null || typeof config !== 'object' || Array.isArray(config)) {