ApeWorX / ApePay

A smart contract payment system built for automated service management
https://apeworx.io/apepay
Apache License 2.0
18 stars 6 forks source link

Enable JS SDK and UI lib to be used in editable install [SBK-303] #46

Closed fubuloubu closed 9 months ago

fubuloubu commented 11 months ago

_Originally posted by @fubuloubu in https://github.com/ApeWorX/ApePay/pull/43#discussion_r1336414376_

mikeshultz commented 10 months ago

Did this to work with the JS SDK in chaosnet app. Not a great permanent solution, but maybe an informative step toward it:

https://gist.github.com/mikeshultz/cc35224bc440affa8fad585b27f8fe9f

I think the biggest challenge is that it's a TS package, so whatever is compiling the host app, needs to be aware of these TS files as well. Otherwise, if it just looks at package.json it'll use the dist in the module prop.

I doubt this is an uncommon problem though, so there's probably a decent workflow for this that doesn't require us live-patching vite configs.

mikeshultz commented 10 months ago

Also, if you run npm link in each package (like @apeworx/apepay and @apeworx/apepay-react) you can run npm link @apeworx/apepay-react @apeworx/apepay to link in both packages. The vite config still needs to be updated for both but to use TS but it works.