Babel not Polyfilling Fetch when using babel-preset-env

前端 未结 4 436
夕颜
夕颜 2020-12-20 13:25

I\'m using Webpack and Babel to build and transpile my ES6 code. However I am missing important Polyfills when trying to support older browsers. e.g iOS8.

Here\'s my

4条回答
  •  不知归路
    2020-12-20 13:50

    In my case Error was ReferenceError: fetch is not defined

    I had the error on firebase with global this and server rendering, following some solutions,I ended up with adding a plugin in webpack then rebuilding I ended with a bunch of errors in the type of "multi ..." which are basically that there are multiple definitions of that library

        new webpack.ProvidePlugin({
               Promise: 'es6-promise',
               fetch: 'imports-loader?this=>global!exports-loader?exports!global.fetch!whatwg-fetch',}),
      
    

    AND FINALLY IN RESOLVE section

    mainFields: ['main']
    

提交回复
热议问题