-
Notifications
You must be signed in to change notification settings - Fork 105
Closed
Labels
Description
Hi,
Cloudflare worker provides a fetch function, however, when I'm webpacking your lib, it does seem to use XMLHttpRequest
ReferenceError: XMLHttpRequest is not defined
I did try to force webpack to use node
module.exports = {
target: "webworker",
entry: "./worker.js", // inferred from "main" in package.json
resolve: {
mainFields: ['module', 'main']
}
};
But it generates another error (global not defined)
Is there a way to force cross-fetch to to use the native fetch function?
as a proof of concept/fugly workaround, I replaced
const Fetch = fetch; //require('cross-fetch');
and it seems to work fine.
pimterry, madeleineostoja, inian, lucaspbordignon, flaksp and 4 more