Is there a way to preload some file before each time I run node
(interactively), just like .vimrc
, .bash_profile
, etc.?
I use node
mainly interactively, and I use the module CSV
a lot, is there a way to avoid typing require('./csv')
every time I start node
?
Create an initialization file (for example ~/.noderc):
var csv = require('csv');
// put a blank line at the end of the file
Now add this line to your shell config (.bashrc / .zshrc / whatever shell you use):
alias nodei="cat ~/.noderc - | node -i"
Voilà!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With