Skip to content

Commit

Permalink
fetch-api: fix require in esm build
Browse files Browse the repository at this point in the history
  • Loading branch information
giannif committed Jun 8, 2023
1 parent d7c4ffb commit 86b2eb8
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions packages/fetch-api/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ export { gifPaginator } from './paginator'
export { default as request } from './request'
export * from './result-types'

const { version } = require('../package.json')
// since we have multiple SDKs, we're defining a hieracrchy
// Fetch API is lowest
if (typeof require !== 'undefined') {
const { version } = require('../package.json')
// since we have multiple SDKs, we're defining a hieracrchy
// Fetch API is lowest

if (!getGiphySDKRequestHeaders()?.get(`X-GIPHY-SDK-NAME`)) {
// send headers with library type and version
appendGiphySDKRequestHeader(`X-GIPHY-SDK-NAME`, 'FetchAPI')
appendGiphySDKRequestHeader(`X-GIPHY-SDK-VERSION`, version)
if (!getGiphySDKRequestHeaders()?.get(`X-GIPHY-SDK-NAME`)) {
// send headers with library type and version
appendGiphySDKRequestHeader(`X-GIPHY-SDK-NAME`, 'FetchAPI')
appendGiphySDKRequestHeader(`X-GIPHY-SDK-VERSION`, version)
}
}

0 comments on commit 86b2eb8

Please # to comment.