Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save scmx/f525c4b2398c52efc9fffbb3075388e8 to your computer and use it in GitHub Desktop.
Save scmx/f525c4b2398c52efc9fffbb3075388e8 to your computer and use it in GitHub Desktop.
How to start Node.js repl with some ESM already imported #node #repl

How to start Node.js repl with some ESM already imported

repl.js

import { foo, bar } from './foobar.js'
import { baz } from './baz.js'
Object.assign(globalThis, { foo, bar, baz })

node -r ./repl.js Now foo, bar, baz will be available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment