- At start of n-ui/main.js have
window.ftNextDummySymbol = function (){return {iterator: {}}};
This will mean any typeofs called before polyfill shave loaded don't error. Safe to do as any typeof
calls looking for Symbol in our application before polyfills have loaded shodul be made to fail anyway
- Create an npm component, which has two files
assume-symbol/symbolcontains
Object.defineProperty(module.exports, 'default', {
get: function () {
return window.Symbol || window.ftNextDummySymbol
}
})
- `assume-symbol/iteratortains
Object.defineProperty(module.exports, 'default', {
get: function () {
return window.Symbol.iterator || window.ftNextDummySymbol.iterator
}
})
These will always give access to Symbol if available
- Add some webpack aliases
{
'core-js/library/fn/symbol/iterator': 'assume-symbol/iterator',
'core-js/library/fn/symbol': 'assume-symbol/symbol'
}
- Unexclude Symbol etc from polyfill.io
- Build without polyfills
Fix whatever the hell is up with header!!!!ImplementArray[@@iterator],NodeList[@@iterator],String[@@iterator]in polyfill.io- Shazzam!
https://github.com/Financial-Times/babel-polyfill-silencer/tree/master