Skip to content

Commit cb3eea8

Browse files
authored
fix(#2140): SVGO fails with ERR_UNSUPPORTED_ESM_URL_SCHEME on Windows (#2141)
1 parent 2582096 commit cb3eea8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/svgo-node.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@ import os from 'os';
22
import fs from 'fs/promises';
33
import path from 'path';
44
import * as svgo from './svgo.js';
5+
import url from 'url';
56

67
/**
78
* @param {string} configFile
89
* @returns {Promise<import('./types.js').Config>}
910
*/
1011
const importConfig = async (configFile) => {
11-
const imported = await import(path.resolve(configFile));
12+
const resolvedPath = path.resolve(configFile);
13+
const imported = await import(url.pathToFileURL(resolvedPath).toString());
1214
const config = imported.default;
1315

1416
if (config == null || typeof config !== 'object' || Array.isArray(config)) {

0 commit comments

Comments
 (0)