inxilpro / node-app-root-path

Determine the root path to your project
MIT License
605 stars 29 forks source link

How would I use this in ES6 syntax (import)? #25

Closed NetOpWibby closed 6 years ago

NetOpWibby commented 6 years ago

I like const reqlib = require('app-root-path').require; but I would love to use this with import. How would I go about doing this?

inxilpro commented 6 years ago

This should work:

import { require as reqlib } from "app-root-path";
reqlib('foo');
NetOpWibby commented 6 years ago

Sweet, thanks man! :D