I have an app up and running, and it works great in Chrome and Firefox. Safari is another story. For the sake of example, let's pretend this is my app:
'use strict';
const x = 3;
function test(){
let y = 4;
return y;
};
When I run it in Safari I get:
SyntaxError: Unexpected keyword 'const'. Const declarations are not supported in strict mode.
Then if I remove 'use strict' I get:
SyntaxError: Unexpected identifier 'y'
At this point I decided to take my first look into transpiling, so I installed Babel and I have my client-side code converted to ES5 and sitting in a new folder.
My question now is, what's the best practice for loading the original code if a user is using Chrome/Firefox, but loading the transpiled code if they're using Safari? Is my head even in the right place here?