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 1+ ---
2+ " @callstack/repack " : patch
3+ ---
4+
5+ Fix failure to load project configuration in Node versions with require(esm)
Original file line number Diff line number Diff line change 1+ import url from 'node:url' ;
12import type { Configuration , ConfigurationObject } from '../../types.js' ;
23
34export async function loadProjectConfig < C extends ConfigurationObject > (
@@ -6,9 +7,10 @@ export async function loadProjectConfig<C extends ConfigurationObject>(
67 let config : Configuration < C > ;
78
89 try {
9- config = require ( configFilePath ) ;
10+ const { href : fileUrl } = url . pathToFileURL ( configFilePath ) ;
11+ config = await import ( fileUrl ) ;
1012 } catch {
11- config = await import ( configFilePath ) ;
13+ config = require ( configFilePath ) ;
1214 }
1315
1416 if ( 'default' in config ) {
You can’t perform that action at this time.
0 commit comments