xmldom
xmldom copied to clipboard
Document Deno example
We should investigate what needs to be done to support deno
I think this is related to the discussion in #214 Not sure if we want to have a single issue for every potentially supported env before agreeing on a general strategy. What do you think?
Reopening, since it makes more sense to discuss support for any specific environment in specific issues.
for Deno users! https://github.com/xmldom/xmldom/issues/316#issuecomment-1159579203
@taisukef thx for providing an example of what needs to be done to switch to modules and support deno.
I still think we need to find a way to additionally continue to support ES5.
I'm guessing that we could migrate the code like you did but put it into mjs files and add a build/transpilation step to continue to support ES5? Ideally in a way that it doesn't break existing usages.
i typically don’t have any problem with
import { DOMParser, XMLSerializer } from "https://esm.sh/@xmldom/[email protected]";
(using esm.sh
to handle the transpiling/compiling). i don’t use typescript though, so i can’t make any guarantees there.
native deno support would be nice, but the above might be useful for people trying to make this work as‐is.
Deno supports importing from npm directly now; for example:
import { DOMParser, XMLSerializer } from "npm:@xmldom/[email protected]";
I’m not sure what the state of TypeScript support is, but as far as JS is concerned, the above works for me.
That is true and awesome.
So it basically boils down to adding an example to the examples folder for documentation purposes.
PRs welcome.