unjs / unenv

🕊️ Convert javaScript code to be runtime agnostic
MIT License
388 stars 21 forks source link

Examples #24

Open lawrencecchen opened 2 years ago

lawrencecchen commented 2 years ago

How can I use this? Are there any examples? Looking to port stripe-node to work on cloudflare pages and wasn't sure if this would be one of unenv's use cases. If someone could guide me, would love to start and contribute an examples folder.

pepicrft commented 2 years ago

I subscribe to this one. Are there docs to read further about how unenv works?

wobsoriano commented 2 years ago

Not sure but this helped me

https://github.com/unjs/unenv/issues/39

pi0 commented 2 years ago

Thanks for linking @wobsoriano. PR is more than welcome if you like to contribute to the docs! I can also give an outline to help :)

janat08 commented 2 years ago

Im looking to try running express in a worker, should I give up? I can't tell how I'd convert a worker event to a request for express.

kevinold commented 1 year ago

@pi0 I'd be happy to contribute docs and or runnable examples, once I understand how to apply this to projects and/or libraries consumed by those projects.

For my use case, I am trying to get around something simple like using libraries like lodash in middleware.js and running into the Dynamic Code Evaluation (e. g. 'eval', 'new Function', 'WebAssembly.compile') not allowed in Middleware error when building a Next.js 12 project for production for it's Edge Runtime. In the case with lodash it has a Node API (Buffer) which is throwing an error.