I have a web application that I create on Nuxt.js, But I have noticed that there are compiling bugs in some of the browsers (Like Safari, IE), I think this is the fault of the Babel configuration, then i run npm run build
ES6 is not compiled, and I have errors in my console
for cross-browsing testing, I am using Browserstack
I have following errors in the console:
Unexpected token '...'. Expected a property name
SyntaxError: Unexpected keyword 'const'. Const declarations are not supported in strict mode.
How can i configure Babel to compile ES6?
Apparently, your code is not working on Safari v10 and below. Looking at some stats here:
It looks like Safari is used with a minority of versions but those are mostly v13 and v14. Those are far more modern then then one you do not support.
Safari v10 is actually from 2007, so I can think that it's safe to say that you can ditch this version totally.
Even if Safari is not an evergreen browser (meaning updating-itself
like Firefox or Chrome), people still using it are not on that old of a version.
You need to remember that if you want to support a version that old, you will heavily impact the overall performance of the whole website for every user. Okay, 0.5% of people will have a better experience (those stuck in 2007) but everybody else will need to carry the weight of that old babel-transpiled version.
You could make 2 bundles (one modern and for super old legacy browsers) and serve either one or the other depending if they do support ES modules. I cannot find the Google/HTTP 203 talking about this one.
But IMO, this is a lot of work (not that trivial) for a super tiny population, I'd rather pass on this and focus on more important things to handle.
Even a11y is reaching more people. Even tho, it's probably on a lower priority than Safari v10.
Here are my 2cts. If I find the video, I may update my answer.