How is the browser downgraded if it does not support dynamic import?
What should I do if my browser supports module but does not support dynamic import?
If your browser does not support dynamic import, you should use an older version of es-module-shims that polyfills dynamic import. Perhaps try version 1.10.1.
Is there any solution that is compatible with the latest version?
I am building a web application framework using importmap and ESM, and I am thinking about how to make it compatible with lower versions of browsers
I saw that version 2.0 is based on browser support for dynamic import() compatibility
Can es-module-shims provide a callback function when compatibility is not available?
I will provide a page similar to this
Very few browsers do not support dynamic import, so the minimum versions here are actually very low.
See https://caniuse.com/es6-module-dynamic-import.
The main thing is Firefox before 67 and Safari before 11.1, IE, or edge below 79.
I'd be surprised if you find many users here at all.
We have many users in China and often receive feedback. I hope there is a hook that can tell the browser that it is no longer supported and prompt users to upgrade their browser
If es-module-shims didn't tell me, I don't know if it's working.
You might try adding something like the following to the top of the page:
<script>
(function () {
var dynamicImportSupported = false;
try { eval("import(m)") } catch (e) { if (e instanceof ReferenceError) dynamicImportSupported = true }
if (!dynamicImportSupported) {
alert('This browser does not support modern JavaScript modules, make sure to use Chrome 79+, Firefox 67+, Safari 11.1+');
}
})();
</script>