Hashnode / Hashnode/starter-kit

iFrame Script Source URL

Open
#163 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
648
Forks
921
PR merge metrics
No merged PRs in 30d

Description

Disclaimer: I am not sure how important this issue is 😅
# Problem
Currently, in the [`packages/utils/renderer/services/embed.ts` ](https://github.com/Hashnode/starter-kit/blob/e8ef16f2343868d11e4bf9e5d57e717527f314f2/packages/utils/renderer/services/embed.ts#L202) the script src is constant that is, `/js/iframe-resizer.js` which do not work if `NEXT_PUBLIC_BASE_URL` is defined.

# Potential Solution
Make the `script.src` dynamic with `NEXT_PUBLIC_BASE_URL`

```js
const BASE_URL = process.env.NEXT_PUBLIC_BASE_URL || '';

script.src = BASE_URL == '' ? `/js/iframe-resizer.js` : `${BASE_URL}/js/iframe-resizer.js`;
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.