This project is a proof-of-concept running Babel to transpile code in the Deno runtime.
-
Clone this repo, e.g.
git clone https://github.com/davidbailey00/deno-babel-demo cd deno-babel-demo
-
Run
npm install
-
Run
npm run demo
(ordeno -A loader.js ./demos/babel
)
Deno has a semi-complete Node.js compatibility library, and in addition, some Node.js standard packages have been ported to browsers and published to NPM (e.g. assert
and util
, both of which are used in this demo). By using these as polyfills, we can emulate a substantial amount of the Node.js environment.
Some files also need to be patched in cases where part of the Node.js standard library hasn't yet been ported to Deno, and/or where the behaviour is subtly different - have a look at scripts/patch-modules.js
to see the patches.