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

Add support for Deno #253

Closed
wants to merge 3 commits into from
Closed

Add support for Deno #253

wants to merge 3 commits into from

Conversation

mathe42
Copy link
Contributor

@mathe42 mathe42 commented Jan 20, 2022

This PR add some info for Deno in the README. (For Deno the polyfiled Browser-Bundle works!)

For types to work (as deno requires full filenames so the extension can't be omited) I added a build step to bundle all types into a single file so no refrences to other files are needed. This ADDS a single bundle.d.ts file in the npm package so we can tell deno to use the specific types.

@jjhbw
Copy link
Collaborator

jjhbw commented Jan 20, 2022

This is great! Thanks. I haven't used Deno yet, but I wonder; why can't it use the non-browser library entrypoint?

@mathe42
Copy link
Contributor Author

mathe42 commented Jan 20, 2022

I'm new to Deno too - only build some small things to test it out - and I love it so I look at my dependencies for one project if they can be adapted for Deno (without the NodeCompatMode)

Deno has a lot of Browser-API that Node doesn't have (localStorage, window, webGPU,...) what make the Browser build work without a change. (only types don't work)

You could use the normal entrypoint but only if you enable "NodeCompatMode" this is a thing I'm not a 100% shure what it all enables but they are nearly there that projects like webpack can run in Deno without a change. Said that for most Project you don't want that enabled. So without this mode enabled

  1. Deno has no "require" function. And no internal modules. -> use polyfiled browser build
  2. Deno requires the full path so with the filename extension. -> bundle types so it doesn't matter

Note that this is just a way to make it work. The Browser build can be optimized for deno (useing Deno internals) but that is a bigger project as it requires a hole additional build.

@jjhbw
Copy link
Collaborator

jjhbw commented Jan 20, 2022

Thanks for the clarification. Deno sounds interesting! I'll have to check it out some time.

I squashed and merged everything manually with 8ea51ac.

@jjhbw jjhbw closed this Jan 20, 2022
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

Successfully merging this pull request may close these issues.

None yet

2 participants