Skip to content

[question] whats the best way to handle failed imports? #356

@dragidavid

Description

@dragidavid

Probably a dumb question but really curious what the best way is to handle if an import like the one below fails. Could be because that remote is down or just a generic error.

If we go with the example below, I've noticed that if main is down (for example, I don't start the dev server), then the GET request that wants to get ExposedLayout just hangs and doesn't resolve at all.

const Layout = dynamic(
  () => {
    const mod = import('main/ExposedLayout');
    return mod;
  },
  { ssr: false },
);

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions