Load settingsCheckModule regardless of module type

GitOrigin-RevId: 7afeb6d5bbe6b5db33c8d1a547009980e6e75c53
This commit is contained in:
andrew rumble 2024-10-02 16:00:49 +01:00 committed by Copybot
parent 46317a9b9c
commit 4919172d52

View file

@ -22,15 +22,21 @@ async function modules() {
} }
async function loadModulesImpl() { async function loadModulesImpl() {
const settingsCheckModule = Path.join( const settingsCheckModuleCjs = Path.join(
MODULE_BASE_PATH, MODULE_BASE_PATH,
'settings-check', 'settings-check',
'index.js' 'index.js'
) )
if (fs.existsSync(settingsCheckModule)) { const settingsCheckModuleEsm = Path.join(
await import(settingsCheckModule) MODULE_BASE_PATH,
'settings-check',
'index.mjs'
)
if (fs.existsSync(settingsCheckModuleCjs)) {
await import(settingsCheckModuleCjs)
} else if (fs.existsSync(settingsCheckModuleEsm)) {
await import(settingsCheckModuleEsm)
} }
for (const moduleName of Settings.moduleImportSequence || []) { for (const moduleName of Settings.moduleImportSequence || []) {
let path let path
if (fs.existsSync(Path.join(MODULE_BASE_PATH, moduleName, 'index.mjs'))) { if (fs.existsSync(Path.join(MODULE_BASE_PATH, moduleName, 'index.mjs'))) {