[whatwg/fetch] After update to 3.0.0 Webpack build is failing on line 72 (#808)

Updating from 2.0.4 to 3.0.0 webpack is failing, see error below. I assume I need to use a different loader but wanted to raise the issue since a quick web search and perusing the issues here did not result in any others having the issue.  This method of including fetch via webpack is shared a lot in examples so there will probably be others.

In my webpack config I include fetch globally like this:

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

```
    ERROR in ./node_modules/whatwg-fetch/fetch.js (./node_modules/imports-loader?this=>global!./node_modules/exports-loader?global.fetch!./node_modules/whatwg-fetch/fetch.js) 72:0
    Module parse failed: 'import' and 'export' may only appear at the top level (72:0)
    You may need an appropriate loader to handle this file type.
    | }
    |
    > export function Headers(headers) {
    |   this.map = {};
    |
     @ ./plugins/wccom-plugins/geo-page-replace/assets/setup.js 1:0-79
```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/issues/808

Received on Tuesday, 11 September 2018 13:50:46 UTC