Skip to content

Commit 8d029e7

Browse files
authored
Fixed a path bug preventing themes from working on Windows (#1664)
1 parent 0037954 commit 8d029e7

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/output/html.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,14 @@ import mergeConfig from '../merge_config.js';
1818
*/
1919
export default async function html(comments, localConfig = {}) {
2020
const config = await mergeConfig(localConfig);
21-
const themePath = config.theme && path.resolve(process.cwd(), config.theme);
21+
let themePath = config.theme && path.resolve(process.cwd(), config.theme);
2222
if (themePath) {
23+
if (process.platform === 'win32'){
24+
// On Windows, absolute paths must be prefixed with 'file:///' to avoid the ERR_UNSUPPORTED_ESM_URL_SCHEME error from import().
25+
themePath = 'file:///' + themePath;
26+
}
27+
2328
return (await import(themePath)).default(comments, config);
2429
}
25-
2630
return (await import('../default_theme/index.js')).default(comments, config);
2731
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy