cozy / cozy-proxy

This repository was part of CozyV2 which has been deprecated - Cozy authentication and routing layer
https://blog.cozycloud.cc/post/2016/11/21/On-the-road-to-Cozy-version-3
GNU Affero General Public License v3.0
26 stars 31 forks source link

Add polyfills to support Array.find and Object.assign #363

Closed CPatchane closed 7 years ago

CPatchane commented 7 years ago

Add polyfills to support Array.find and Object.assign in older browsers. Fix tested using Chromium v42

gregorylegarec commented 7 years ago

@CPatchane Travis fails with a node4 environment. Can you investigate ?

CPatchane commented 7 years ago

@gregorylegarec It's fixed. Good to know: think to empty Travis caches, that can help.

gregorylegarec commented 7 years ago

@m4dz We discussed with @CPatchane and we think that we should use the power of webpack to handle polyfills like those ones. What your opinion ? Any recommendation ? (https://www.npmjs.com/package/webpack-polyfills-plugin ? https://www.npmjs.com/package/imports-loader ?

m4dz commented 7 years ago

My recommandation for polyfills: always bet on Babel 👅

In fact, we should use babel-preset-env for Babel preset (wich is like an autoprefixer for Babel transpiling) and use its useBuiltIns directive that apply polyfills from babel-polyfill in the same manner (see https://github.com/babel/babel-preset-env#usebuiltins-boolean). If you want some example, I'll add it to the https://github.com/cozy/cozy-template/pull/17 tomorrow 😄

m4dz commented 7 years ago

After discussing, let's say we stuck on manually polyfills as we don't (yet) use Babel on the proxy. Later, when an heterogeneous codebase will come, mixing JS(X) and Coffee, we could use a babel!coffee loader to pass output from Coffee-Script to Babel and then use the Babel env capabilities 👍

gregorylegarec commented 7 years ago

Ok, so let's wait to add Babel to the project to handle polyfills with it.

I finally succeed in testing the app on browserstack with Chrome 38, it only fail at using fetch, so I presume the rest is OK.

Thanks @CPatchane 👍