rollup-plugin-node-deno
rollup-plugin-node-deno copied to clipboard
Convert NodeJS to Deno compatible code with rollup
rollup-plugin-node-deno
Convert NodeJS to Deno compatible code with rollup.
- Converts builtin imports to deno node compat
- Injects polyfills for global built-ins like
timersby usage
🧪 Note: This is an experimental plugin.
Install
# npm
npm install rollup-plugin-node-deno
# yarn
yarn add rollup-plugin-node-deno
Usage
Example rollup.config file:
Note: Config below needs installing @rollup/plugin-node-resolve @rollup/plugin-commonjs @rollup/plugin-json.
import resolve from '@rollup/plugin-node-resolve'
import commonjs from '@rollup/plugin-commonjs'
import json from '@rollup/plugin-json'
import deno from 'rollup-plugin-node-deno'
export default {
input: 'src/index.mjs',
output: {
file: 'dist/index.mjs',
format: 'esm'
},
plugins: [
deno(),
resolve(),
json(),
commonjs()
]
}
Support
Deno Node compatibility (https://deno.land/[email protected]/node/README.md):
assertassert/strictpartlyasync_hookspartlybufferchild_processpartlyclusterpartlyconsolepartlyconstantspartlycryptopartlydgrampartlydiagnostics_channeldnspartlyeventsfspartlyfs/promisespartlyhttppartlyhttp2httpspartlyinspectorpartlymodulenetospartlypathpath/posixpath/win32perf_hooksprocesspartlypunycodequerystringreadlinereplpartlystreamstream/promisesstream/webpartlystring_decodersystimerstimers/promisestlstrace_eventsttypartlyurlutilpartlyutil/typespartlyv8vmpartlywasiwebcryptoworker_threadszlib
Extras: (see ./lib/extras)
node-fetch(using nativefetch)chalk(using deno.land/x/chalk_deno)
Globals:
processglobal(~>globalThis)Buffer- Timers (
setTimeout, clearTimeout, setInterval, clearInterval, setImmediate, clearImmediate)
Related
- https://github.com/egoist/rollup-plugin-deno
License
MIT