-
I can't make Opera Mini (extreme savings mode) pick up my javascript bundles. I'm pretty sure my settings are correct, because I've got IE11 to work almost flawlessly now through trial and error and judicious use of the My error seems to be related to the bundling itself, not any code I've put in there myself. I get this in the (extremely limited) Opera Mini debug console (khio.dev is my test domain (sadly not open to the public) and application_head is my main entrypoint):
I didn't write this code, but I guess the variable |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 2 replies
-
Hi @evenreven!
Vite Ruby injects the polyfill when using From the error, it seems that the polyfill has not loaded when the script attempts to perform a SystemJS import. Given that you mention it works in IE11, we can discard other potential causes, and you may want to check that the polyfill is effectively being loaded in Opera Mini—perhaps an error occurs when parsing the polyfill that causes the If you can't pinpoint the issue, please share the If it turns out to be specific to Opera Mini, it might be worth asking in the SystemJS repo, in case there's a known issue of some sort. Unrelated: it seems to are using an older version of |
Beta Was this translation helpful? Give feedback.
-
Thanks for the quick reply. I just upgraded with I took a closer look now and compared the rendered head element on Opera Mini and IE11. Head element from view source<html lang="nb" class="js unsupported-browser">
<head>
<meta charset='utf-8' />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Forside - Kunsthøgskolen i Oslo</title>
<meta name="description" content="Kunsthøgskolen i Oslo er Norges største kunsthøgskole med fagområdene teater, dans, opera, kunst og håndverk, design og billedkunst." />
<link rel="canonical" content="/" />
<script>
document.documentElement.classList.remove('no-js');
document.documentElement.classList.add('js');
</script>
<script nomodule="true" src="/vite/assets/polyfills-legacy.b26915e4.js"></script>
<script nomodule="true">System.import('/vite/assets/browser_support.2d2e7b79-legacy.js')</script>
<meta name="author" content="Kunsthøgskolen i Oslo | Oslo National Academy of the Arts">
<meta name="title" content="Forside - Kunsthøgskolen i Oslo" />
<meta property="image" content="/meta-icon-512x512.png"/>
<meta property="og:title" content="Forside - Kunsthøgskolen i Oslo" />
<meta property="og:description" content="Kunsthøgskolen i Oslo er Norges største kunsthøgskole med fagområdene teater, dans, opera, kunst og håndverk, design og billedkunst." /><meta property="og:url" content="https://khio.dev/">
<meta property="og:locale" content="nb" />
<meta property="og:type" content="website">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="@khiotweet">
<meta name="twitter:creator" content="@khiotweet">
<script src="/vite/assets/application_head.ca96f8d1.js" crossorigin="anonymous" type="module"></script>
<link rel="modulepreload" href="/vite/assets/vendor.95ed0bd4.js" as="script" crossorigin="anonymous">
<link rel="stylesheet" media="all" href="/vite/assets/application_head.4f035fd9.css" crossorigin="anonymous" />
<script nomodule="true" src="/vite/assets/polyfills-legacy.b26915e4.js"></script>
<script nomodule="true">System.import('/vite/assets/application_head.b3be08cc-legacy.js')</script>
<link rel="icon" href="/favicon.ico">
<link rel="icon" href="/favicon.svg" type="image/svg+xml">
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
<link rel="manifest" href="/manifest.webmanifest">
<meta name="theme-color" content="#ffffff">
</head>
<!-- The body -->
</html> The Obviously the script itself works, or it wouldn't show up on IE. That also means the SystemJS import works on most browsers, but maybe flakes out on Opera Mini. Side-note: I can also infer from this that inline scripts work fine in Opera Mini, since the "no-js" class was successfully changed to "js", it's just the SystemJS imported scripts that fail. I see the polyfill is imported twice, I guess that's because I have two entrypoints? I tried to remove the browser_support js now, didn't make any difference to Opera Mini. |
Beta Was this translation helpful? Give feedback.
-
One would expect some kind of error to happen when loading To continue the investigation, you could add an inline script after the legacy tags, and log the System global variable. If it's not defined, then it's time to check the contents of
A shortcoming of the helper tag, which I wrote to cover simpler cases with a single entrypoint. In the next version I could change |
Beta Was this translation helpful? Give feedback.
-
Yeah, sorry, there is more to the Opera Mini I'll look through it and google the errors and post back. And thanks for the suggestions, I'll try that later today or tomorrow. 👍 |
Beta Was this translation helpful? Give feedback.
-
I don't think it's an upstream issue. I think there is another upstream issue here (probably with vite-plugin-legacy) because I have to set up all polyfills manually instead of getting it done by Babel and core-js, but that's not what's keeping me from producing a bundle that works in Opera Mini. :) I removed all legacy polyfills now, and I'm adding one by one and testing, and it seems Opera Mini chokes when it comes to the webcomponents polyfill. (I'm not using webcomponents, but it's needed for allowing extending the window object on IE11, apparently (the dreaded I'll try some more tomorrow before I give up and choose to drop support. The tips out there on polyfilling Opera Mini effectively is surprisingly sparse, considering its market share, so it's mostly guesswork. |
Beta Was this translation helpful? Give feedback.
-
I gave up on this and tried something else. I've done a lot of testing to make sure a barebones version of my site will work well with javascript disabled. So I'm leveraging this by serving javascript with only script type module without legacy bundle at all, and that's that. For a couple of necessary DOM manipulation bits (lazyloading of images specifically), I have a nomodule inline script at the end of the body element that takes care of the bare minimum to make the site work (basically it does what my noscript tags do for those with js disabled). Sucks for IE11 users since I had a working setup ready to go, but making Opera Mini kinda work is a lot more important due to the user base. Since this isn't really about vite_ruby after all, I'll mark one of your replies as answer. |
Beta Was this translation helpful? Give feedback.
One would expect some kind of error to happen when loading
polyfills-legacy.b26915e4.js
, but if nothing happens, perhaps it's a matter of the order in which scripts are executed.To continue the investigation, you could add an inline script after the legacy tags, and log the System global variable. If it's not defined, then it's time to check the contents of
polyfills-legacy.b26915e4.js
, verify that System is being defined globally there, and maybe inline that script as well to check if Opera will output a more useful error.…