Skip to content
This repository was archived by the owner on Oct 10, 2022. It is now read-only.

Commit 64a7822

Browse files
committed
Work around strange webpack behavior
Sometimes webpack will import node-fetch with a default export property, and other times with a commonjs default export. You never know which one you are gonna get!
1 parent 27f6ce3 commit 64a7822

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/open-api/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ const get = require('lodash.get')
22
const set = require('lodash.set')
33
const queryString = require('qs')
44
const http = require('http')
5-
const fetch = require('node-fetch')
6-
const Headers = fetch.Headers
5+
const fetch = require('node-fetch').default || require('node-fetch') // Webpack will sometimes export default exports in different places
6+
const Headers = require('node-fetch').Headers
77
const camelCase = require('lodash.camelcase')
88
const { JSONHTTPError, TextHTTPError } = require('micro-api-client')
99
const debug = require('debug')('netlify:open-api')

0 commit comments

Comments
 (0)