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

Deno support #28

Open
rluvaton opened this issue Jan 2, 2021 · 4 comments
Open

Deno support #28

rluvaton opened this issue Jan 2, 2021 · 4 comments

Comments

@rluvaton
Copy link

rluvaton commented Jan 2, 2021

Can you please add Deno support?
Since this project doesn't have any dependency it should be fairly easy

@marcelklehr
Copy link
Owner

What does deno need?

@rluvaton
Copy link
Author

rluvaton commented Jan 2, 2021

You don't really need anything but mod.js file is welcome

@marcelklehr
Copy link
Owner

Cool. You're welcome to submit a pull request in case you don't want to wait for me to get around to this :)

@rluvaton
Copy link
Author

rluvaton commented Jan 3, 2021

Cool. You're welcome to submit a pull request in case you don't want to wait for me to get around to this :)

@marcelklehr I started to work on it so I added the file mod.js

export * as topsort from './index.js';

And then I wanted to test if this work so I import it and got the error

error: Uncaught ReferenceError: module is not defined
module.exports = function(edges) {

There are a couple of options to solve this issue:

  1. Change the code to use the export keyword, not a good option cause this will break some node's version capabilities.
  2. import module from https://deno.land/std@0.83.0/node (Deno Node compatibility) to support CommonJS (CJS) importing. import big file for small change
  3. Developers that want to use this with Deno will need to use some CDNs that convert node project to browser compatible package (module is not needed).
    An example of CDN that will work is SkyPack and there are more.

I prefer the 3rd option, which won't change the code and can prevent possible errors (which is critical cause many libraries depend on this) If you want I can update the README with instructions for how to use this library with Deno.

Love to hear what you think

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

2 participants