DEV Community

Discussion on: Going Buildless

Collapse
 
westbrook profile image
Westbrook Johnson

This import maps things is pretty cool! When you used it to polyfill kv-storage you used /web_modules/kv-storage-polyfill.js as the initial call:

      “/web_modules/kv-storage-polyfill.js": [
        "std:kv-storage",
        "/web_modules/kv-storage-polyfill.js"
      ]
Enter fullscreen mode Exit fullscreen mode

Would it be possible to go the other way:

      “std:kv-storage": [
        "std:kv-storage",
        "/web_modules/kv-storage-polyfill.js"
      ]
Enter fullscreen mode Exit fullscreen mode

Which would allow the seemingly more “correct” import { StorageArea } from ‘std:kv-storage’? Or maybe “long lasting” is the better word…

Collapse
 
thepassle profile image
Pascal Schilp

It seems that as of now, this is not possible, chrome will log the following in the dev tools:
Ignored an import map key "std:kv-storage": Invalid key (non-fetch scheme)

Even though, according to the spec that should be possible yeah: github.com/WICG/import-maps#for-bu...

Collapse
 
bennypowers profile image
Benny Powers 🇮🇱🇨🇦

What about importception

{
      "kv-storage": [
        "/web_modules/kv-storage-polyfill.js"
      ],
      "/web_modules/kv-storage-polyfill.js": [
        "std:kv-storage",
        "/web_modules/kv-storage-polyfill.js"
      ]
}

Then in use

import * as KvStorage from 'kv-storage';

Would that work?

Thread Thread
 
thepassle profile image
Pascal Schilp

Hehe, that'll still result in: Ignored an import map key "std:kv-storage": Invalid key (non-fetch scheme)

Thread Thread
 
westbrook profile image
Westbrook Johnson

What a shame...the future can't come fast enough!