Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide ready to use file for browsers #30

Open
coolharsh55 opened this issue Jun 27, 2021 · 5 comments
Open

Provide ready to use file for browsers #30

coolharsh55 opened this issue Jun 27, 2021 · 5 comments

Comments

@coolharsh55
Copy link

Currently, the creation of a browser-usable script requires npm, typescript, and compiler (e.g. browserify) to generate a standalone file ready for usage in the browser. By providing a dist version in a single-file, the library can be used in any webpage without backend requirements. This process is trivial (e.g. add commands to build process to generate file and put in dist folder) and would save time (e.g. for every single download and compilation of file for browsers).

P.S. Thanks for this work : )

@rubensworks
Copy link
Owner

I'm a bit hesitant to do this.

The problem of such monolithic builds is that they can become really big. Currently, the package is 93.1 kB in size, while adding such a dist build would make this significantly larger.
Furthermore, due to the monolithic nature of such builds, tree-shaking functionality of tools such as webpack becomes impossible, which is detrimental for achieving small bandwidth footprints of client-side apps.

Going the ES Modules route might be a better solution, so I'm open to that (once support stabilizes a bit).

@coolharsh55
Copy link
Author

Thanks for replying to this. I'm not knowledgeable about any of these things (npm, node, js, server side packaging) - so I'll leave it to your experience. That said, and if I understand correctly that the package size is related to the size of releases, dist builds could be put in a different branch or repo. Comunica browser builds offers ready to use monolithic scripts - so something similar would be nice to have.

@rubensworks
Copy link
Owner

Indeed, placing this in a different repo, and exposing via something like GH Pages definitely makes sense.

I don't have the bandwidth to take this up myself, but perhaps someone else might if you're willing to place a bounty on this via the Comunica Association.

(That being said, I think the easiest solution would be to just write your JS as an npm module with a dependency on this package, and pack it up for the browser via webpack, similar to how we do it in https://github.com/comunica/jQuery-Widget.js)

@TakashiSasaki
Copy link

First and foremost, thank you, Ruben, for publishing such a useful library.
I also think it would be very convenient if a file that is immediately available in the browser were provided.
However, this can be achieved by webpacking it myself,
so I have created a webpack for my own use to handle it.
I'm not sure if my approach is correct, but I will share what I have webpacked.
https://rdfa-streaming-parser.glitch.me/

@rubensworks
Copy link
Owner

Very nice work @TakashiSasaki!
A good example for people reading this issue in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants