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

Research direction

Start in packages/utils/renderer/services/embed.ts at the script source around line 202, and inspect how NEXT_PUBLIC_BASE_URL is exposed and used. Confirm the iframe-resizer script URL works with a configured base URL while preserving the current path when no base URL is set.

Written by the indexing model from the issue text.

Assessment

Tech stack
nextjs, typescript
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.