Skip to content

Support gating with Progressive Enhancement or Graceful Degredation #153

Open
@Westbrook

Description

@Westbrook

With import attributes being a feature of module imports that hoist, has there been thought put into how to support them with Progressive Enhancement or Graceful Degredation? Maybe this is enough:

try {
  import('./styles.css', { with: { type: 'css' } });
  import('./modern.js');
} catch (e) {
  import('./legacy.js');
}

But it feels so awkward to rely on try/catch with dynamic imports, which may later have more dynamically imported content included, powering the feature gate.

This is so much like the move to ES Modules at large where we got access to nomodule to unlock access to a build with modules and a separate one without. A noattributes sort of attribute could be a great place to start the conversation.

I remember a lot of feature checking conversation in the wake of nomodule, so maybe there are better options in the intervening years?

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