@platformatic/foundation 3.32.0 → 3.33.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -532,9 +532,14 @@ export async function loadConfiguration (source, schema, options = {}) {
532
532
  return config
533
533
  }
534
534
 
535
- export function loadConfigurationModule (root, config, pkg) {
535
+ export async function loadConfigurationModule (root, config, pkg) {
536
536
  pkg ??= extractModuleFromSchemaUrl(config, true).module
537
537
 
538
- const require = createRequire(resolve(root, 'noop.js'))
539
- return loadModule(require, pkg)
538
+ try {
539
+ const require = createRequire(resolve(root, 'noop.js'))
540
+ return await loadModule(require, pkg)
541
+ } catch (error) { // Fallback to the one bundled with Platformatic runtime
542
+ const require = createRequire(import.meta.filename)
543
+ return loadModule(require, pkg)
544
+ }
540
545
  }
package/lib/module.js CHANGED
@@ -173,7 +173,7 @@ export async function loadModule (require, path) {
173
173
  try {
174
174
  loaded = require(path)
175
175
  } catch (err) {
176
- /* c8 ignore next 4 */
176
+ /* c8 ignore next 10 */
177
177
  if (err.code === 'ERR_REQUIRE_ESM') {
178
178
  const toLoad = require.resolve(path)
179
179
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/foundation",
3
- "version": "3.32.0",
3
+ "version": "3.33.0-alpha.1",
4
4
  "description": "Platformatic Foundation",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",