skypackjs / skypack-cdn

An issue tracker for the CDN
107 stars 5 forks source link

[Feature] Polyfill Node built-ins for raw files (deep imports) #50

Open drwpow opened 4 years ago

drwpow commented 4 years ago

Skypack does polyfill some Node built-ins, but only for the deep imports, not raw mode. Adding this would let us load many more packages (such as #37).

FredKSchott commented 4 years ago

this is actually different, it's the process object specifically not getting polyfilled. But, this is still a useful task to work on.

the nice thing about CJS is that at this point, we just need it to work so that authors have time to upgrade to ESM, where they'll get all the optimizations we provide for free (especially around export maps for optimized bundling).

matthewp commented 3 years ago

Another solution here is to specifically polyfill process.env.NODE_ENV. That would be easy to do via regex replace and is safer than polyfilling the whole object. Since that is probably the most common use-case for using process it could be a quick win.