Hashnode / Hashnode/starter-kit
iFrame Script Source URL
未关闭
- 主要语言
- TypeScript
- 星标
- 648
- 派生
- 921
- PR 合并指标
- 30 天内没有已合并 PR
描述
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`;
```
贡献指南
评估
这个 Issue 还没有评估数据。