link-preview-js icon indicating copy to clipboard operation
link-preview-js copied to clipboard

replaced url package with URL constructor

Open IvanKalinin opened this issue 1 year ago • 3 comments

This PR solved #149 by replacing url dependency with the native URL() constructor.

This constructor supports by Node.js since v6.13 https://developer.mozilla.org/en-US/docs/Web/API/URL/URL The minimum Node.js version is 18 according to package.json requirements.

IvanKalinin avatar Feb 22 '25 05:02 IvanKalinin

Does this run in React Native?

ospfranco avatar Feb 22 '25 09:02 ospfranco

Good question. It seems like there might be some issues with React Native. As an option, React Native developers can include a polyfill. https://github.com/facebook/react-native/issues/38656#issuecomment-1660117381

Also, I think it is still a good idea to eliminate as many dependencies as possible for the web, reduce the bundle size, follow the standards as much as possible, make the polyfills optional, and use them where we actually need them.

IvanKalinin avatar Feb 22 '25 22:02 IvanKalinin

I will keep this open but not merge it, maybe some time in the future. No need to break what is working for the sake of only one platform.

ospfranco avatar Feb 23 '25 07:02 ospfranco