Last active
August 29, 2015 14:18
-
-
Save ALF-er/2112327864ec02d51289 to your computer and use it in GitHub Desktop.
webpack + exports-loader + whatwg-fetch + Chrome 42+ issue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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 | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How do I fix that issue?