hindley-milner-parser-js
hindley-milner-parser-js copied to clipboard
browser support
Based on sanctuary-js/sanctuary-site#23 it seems one can't simply import HMP via a <script>
tag. I would very much like to be able to do so. I suggest either:
- including a browser build in the tarball; or
- having a single source file which uses the export mechanism appropriate to the environment.
I prefer the latter. It adds a bit of boilerplate, but obviates the need for a build step. :)
I think we need a build step as we are depending on nearley. There is already a build step though, which I added after reading https://github.com/fluture-js/Fluture/pull/58, so no big deal there.
I guess we'd basically be doing what ramda is to create the version in dist? Inlining require
and adding a little wrapper around it? I couldn't find an npm package that does this, do you know of one?
I couldn't find an npm package that does this, do you know of one?
No. I haven't yet needed such a tool.
k I'll keep looking/figure something out.
May I suggest using Rollup to create an IIFE or UMD build? Using that it should be possible to bundle the nearley
dependency in your build. This should make it possible to directly use the build in a <script>
tag.
Thanks @mickdekkers . Ended up not needing it for this issue as we bundled a parent lib for the browser, but I'll leave the issue open and look into using rollup for a browser build for this lib.