fynjs API
    Preparing search index...

    Function tryImport

    • try to import an optional module, with optional handling in case it's not found

      Parameters

      • meta: ImportMetaLike

        import.meta from the caller's context

      • specifier: string

        the module specifier to import

      • OptionaloptsOrMsg: OptsOrMessage

        options, or message to log when the module is not found

      • log: LogFunction = defaultLog

      Returns Promise<any>

      the module namespace, or the default / notFound result when not found

      Resolution happens first. Once the specifier resolves, any error from importing it is a real error from the module itself and is routed to fail (or rethrown) -- never mistaken for the dependency being absent.