Skip to content

Issues importing convex/browser from esm.sh #116

Description

@guillaumebrunerie

(first reported at get-convex/convex-backend#296, but I guess this is actually the correct repo)

I have been successfully importing convex/browser from esm.sh for some time now as follows:

import { ConvexClient } from "https://esm.sh/convex/browser";

(the reason I am using esm.sh is because I want to trigger a mutation from a service worker and that’s the easiest way I found to make it work)

But it recently stopped working with the error message "A bad HTTP response code (404) was received when fetching the script." in the console.

Looking at https://esm.sh/convex/browser, it looks pretty suspicious:

/* esm.sh - convex@1.31.2/browser */
import "/./components/paths?target=es2022";
import "/./sync/client?target=es2022";
import "/convex@1.31.2/es2022/convex.mjs";
import "/convex@1.31.2/es2022/values.mjs";
export * from "/convex@1.31.2/es2022/browser.mjs";
export { default } from "/convex@1.31.2/es2022/browser.mjs";

Compare to https://esm.sh/convex@1.30/browser:

/* esm.sh - convex@1.30.0/browser */
import "/convex@1.30.0/es2022/convex.mjs";
import "/convex@1.30.0/es2022/dist/esm/browser/logging.mjs";
import "/convex@1.30.0/es2022/dist/esm/browser/sync/paginated_query_client.mjs";
import "/convex@1.30.0/es2022/dist/esm/browser/sync/udf_path_utils.mjs";
import "/convex@1.30.0/es2022/dist/esm/common/index.mjs";
import "/convex@1.30.0/es2022/dist/esm/server/api.mjs";
import "/convex@1.30.0/es2022/dist/esm/values/errors.mjs";
import "/convex@1.30.0/es2022/dist/esm/vendor/long.mjs";
import "/convex@1.30.0/es2022/values.mjs";
export * from "/convex@1.30.0/es2022/browser.mjs";

In particular I’m not sure how the line import "/./components/paths?target=es2022"; can load the right file?

It might be an issue at esm.sh, but given that it worked fine before, I guess it’s an issue in Convex instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions