3 ms·
https://developers.google.com/web/updates/2019/03/kv-storage#what_about_browsers_that_dont_support_modules_at_all https://developers.google.com/web/updates/2019
by domenicd 8y ago
https://developers.google.com/web/updates/2019/03/kv-storage#what_about_browsers_that_dont_support_modules_at_all https://developers.google.com/web/updates/2019/03/kv-storage... , and especially the demo , show how you can use tooling for this use case.
- chr1 8y agoMy question is a bit different: how to load the native std:kv-storage from a webpack bundle. It seems the only options are to either load the whole bundle as a module, or use async import like: eval('import("std:kv-storage")').
- domenicd 8y agoAh, yeah, unlike bundling tools like Rollup, webpack doesn't have the ability to output modern JavaScript module scripts, only classic scripts. The article links to a feature request on webpack to support this: https://github.com/webpack/webpack/issues/8896 https://github.com/webpack/webpack/issues/8896 In the meantime, there are lots of workarounds, such as e.g. creating a script to bridge from built-in modules (which webpack doesn't support) to globals (which webpack does support). E.g. `import { storage } from 'std:kv-storage'; window.kvStorageStorage = storage;` then use `kvStorageStorage` in your webpack code.