Closed Gungy2 closed 1 year ago
Thanks. I'd add the docs here:
https://github.com/reach-sh/reach-lang/blob/master/docs/src/frontend/index.md?plain=1#L23
In something like
:::note
If you have problems with JavaScript bundlers in your browser, you can instead require from `@reach-sh/stdlib/browser`.
:::
I don't really have a good way of testing... I'm assuming it is working for you?
I don't really have a good way of testing... I'm assuming it is working for you?
Yes, I tested it locally. It is as easy as creating a skeleton Webpack 5 or Vite project, importing the library and logging the returned object. If everything is correct, it should build with no issues.
Thank you so much!
By adding a separate entrypoint
/browser
for the library, we make it much easier for the users to import the library in a browser, like so:@reach-sh/stdlib/browser
.Summary
This would address #152, #1316 and #1560, by using the library like so:
import { ... } from "@reach-sh/stdlib/browser
. In the current implementation there is the field "browser" that points to the right entrypoint, but that is not usually supported by default in most bundlers. Moreover, it does not work at all if used with Typescript, since the right types are not exposed.Probably, documentation will need to be updated, I am also willing to do that if pointed in the right direction. Thank you for taking the time to review this!