I have injectr.onload set up to run files through babel like so:
injectr.onload = (file, content) => {
return require('babel').transform(content, {
filename: file,
optional: ['runtime', 'es7.classProperties', 'es7.objectRestSpread']
}).code;
};
This works but it seems like the polyfilled methods such as [1, 2, 3].includes(2) have to be written as Array.includes([1, 2, 3], 2) instead. Even if I prepend the file content with require('babel/polyfill') I get the same result.
Do you know why the polyfilled methods wouldn't be usable with an injected module?
I have
injectr.onloadset up to run files through babel like so:This works but it seems like the polyfilled methods such as
[1, 2, 3].includes(2)have to be written asArray.includes([1, 2, 3], 2)instead. Even if I prepend the file content withrequire('babel/polyfill')I get the same result.Do you know why the polyfilled methods wouldn't be usable with an injected module?