Skip to content

Instantly share code, notes, and snippets.

@ALF-er
Last active August 29, 2015 14:18
Show Gist options
  • Save ALF-er/2112327864ec02d51289 to your computer and use it in GitHub Desktop.
Save ALF-er/2112327864ec02d51289 to your computer and use it in GitHub Desktop.
webpack + exports-loader + whatwg-fetch + Chrome 42+ issue
/* webpack loader:
{
test: /fetch.js$/,
loaders: ["exports?fetch=window.fetch,Headers=window.Headers,Request=window.Request,Response=window.Response"]
}
*/
import { fetch, Headers } from "whatwg-fetch";
let headers = new Headers();
headers.append("Accept", "application/json");
let body = JSON.stringify({});
fetch( // Uncaught TypeError: Illegal invocation
"localhost",
{
method: "POST",
headers,
body
}
);
@gyzerok
Copy link

gyzerok commented Jun 26, 2015

How do I fix that issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment