Galooshi / import-js

A tool to simplify importing JS modules

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use ImportJS without package.json

mikabytes opened this issue · comments

commented

We use native ES modules and have no need for a bundler such as webpack. I would like to use this awesome tool anyway. However, it doesn't work because ImportJS have to have a parent directory with a package.json file.

The current workaround is to add the package.json just to fool the tool. Could we maybe add an option to instead look for a .git folder?

That sounds like it could work. Or we could allow people to drop a .importjs-root (or something) file in the directory structure. The .git approach is likely a breaking change, but the .importjs-root approach would be backwards-compatible.

If you end up starting a PR in this area, here's a good place to start: https://github.com/Galooshi/import-js/blob/b9e202ad3fb6962273394d03b2153fd39030bb88/lib/findProjectRoot.js

commented

Thanks for pointing me in the right direction. I think I got good PR for it, but let me know if I missed some convention. I'll give it another go.

I've started working on releasing v4. There are a few other changes I want to make as part of that change but I'll release it as soon as it's ready.