File tree Expand file tree Collapse file tree
packages/repack/src/commands/common/config Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import fs from 'node:fs' ;
22import path from 'node:path' ;
3+ import url from 'node:url' ;
34import { importDefaultESM } from '../../../helpers/index.js' ;
45import type { Configuration , ConfigurationObject } from '../../types.js' ;
56
@@ -38,12 +39,14 @@ export async function loadProjectConfig<C extends ConfigurationObject>(
3839 let config : Configuration < C > ;
3940
4041 if ( isEsmFile ( configFilePath ) ) {
41- config = await importDefaultESM ( configFilePath ) ;
42+ const { href : fileUrl } = url . pathToFileURL ( configFilePath ) ;
43+ config = await importDefaultESM ( fileUrl ) ;
4244 } else {
4345 config = require ( configFilePath ) ;
44- if ( 'default' in config ) {
45- config = config . default as Configuration < C > ;
46- }
46+ }
47+
48+ if ( 'default' in config ) {
49+ config = config . default as Configuration < C > ;
4750 }
4851
4952 return config ;
You can’t perform that action at this time.
0 commit comments