Skip to content
This repository was archived by the owner on Feb 26, 2025. It is now read-only.
This repository was archived by the owner on Feb 26, 2025. It is now read-only.

Detecting support / extensible web? #171

@remy

Description

@remy

I've found that importmap has landed in Chrome stable (not sure exactly when or if it's an experimental flag that's turned on, but bear with me).

This makes me very pleased that this code works seamlessly:

<script type="importmap">
{
  "imports": {
    "vue": "/vendor/vue.js"
  }
}
</script>
<script type="module" src="./index.js"></script>
<script nomodule src="./bundle.js"></script>

Where index.js is doing import Vue from 'vue and the nomodule bundle is able to use webpack to bundle up Vue as required.

Except as soon as I ran this in Firefox the code failed hard. Firefox has support for type="module" but knows nothing about import maps, so it failed to import Vue.

I'm happy to target only browsers that have type="module" and type="importmap" as I have my nomodule fallback support - but how?

I can't see any way that I can state this code only works if importmap is supported. Is this included in the specification anywhere?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions