Alright, after a lot of hair loss I’ve narrowed down a very significant bug.
I have a SvelteKit site (which uses Vite under the hood) and it’s using auth0-spa-js, which pulls in core-js.
The issue appears because core-js uses a weird syntax to get the toString function of a number, like so: 1.0.toString
this will then windup getting minified to 1 .toString
which is perfectly valid javascript.
The issue comes with CF, after it applies it’s own minification: 1 .toString
turns into: 1.toString
which is invalid javascript.
Disabling minification in Vite doesn’t work, as: 1.0.toString
will still get minified by CF, to: 1.toString
which is still invalid javascript.
My only solution has been to disable Cloudflare’s minification of Javascript, which is barely a solution as we have other subdomains that benefit from having minification enabled. Any thoughts for a better temporary fix are appreciated. Cheers.
(Links are not allowed, but you can see the weird syntax yourself in uid.js (ln#5) in the core-js repo.)
Yep, got suggested this by another person as well. I’ve done that now and now the rest of site is happy. Still would like to see this issue resolved though.
I had the same issue. I am using Vite.
Disabling auto minification of JS solved this problem. This can be done in the settings Speed → Optimization → Auto Minify.
I’m having the same problem with Home Assistant and the Zigbee2MQTT addon (https://github.com/zigbee2mqtt/hassio-zigbee2mqtt). The Web GUI for Z2M does not load due to several instances of 1.toString in the minified code when minifying is enabled.