DEV Community

Discussion on: A Better Way to Import Local Node.js Modules

Collapse
 
tusharpandey13 profile image
Tushar Pandey

The title says 'import' but the code uses require. I've yet to find a nice method for this that works with es6.

Collapse
 
janniks profile image
janniks

Good point, I’ll try to test this with import statements and rewrite if it doesn’t work

Collapse
 
tusharpandey13 profile image
Tushar Pandey

Btw, you can use aliasing. Ive mentioned it on one of my posts, the guide to es6 one. I don't remember it sorry lol. It lets you use ~ as project root (or some specific directory of your choice) in your import statements.