ES Module and Deno support #8492
aaronhuggins
started this conversation in
Ideas
Replies: 1 comment
-
Hi, @AlbaHerrerias; CC-ing you since you've done a ton of work to get ES6 going in the codebase. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey @janl, @dheimoz. I'd like to revisit support for Deno and ES Modules. I have some thoughts about how this can be accomplished, and would like to contribute code.
I have spent time porting PouchDB over at aaronhuggins/pouchdb_deno, relying on Skypack.dev and workarounds to get it functional and reliable on that platform. This is, however, sub-optimal: bootstrap code has to be maintained separately, Skypack has to transpile code which may lead to side-effects, the releases for Deno have to be pinned to a version of PouchDB, some transpiled modules mutate the Window object which will be deprecated in a future release of Deno.
I feel that Deno support would be trivial if this codebase supported ES Modules. ESM is supported by the browser, Node, and Deno. While there are workarounds, such as
createRequire
in both Node and Deno, these add extra steps and are counter-intuitive to beginners and developers already familiar with ESM.A nice-to-have which I think would benefit PouchDB would be to use ES6
class
notation. This might already be covered by #8451, but I don't see this mentioned. Additionally, theinherits
pattern is deprecated, and there is compatibility issues with extending PouchDB prototypal "classes" usingclass
notation. Moving to the more recent language-level style of inheritence would ease adoption, in my opinion.Thanks for getting your eyes on this, and for enabling discussions. Let me reiterate, I'm not asking for additional burden on the PouchDB team. I am offering to contribute, and would very much love to have a discussion around this effort.
Beta Was this translation helpful? Give feedback.
All reactions