import-js
import-js copied to clipboard
Import location not added on file change in certain cases
When there was a file b.js containing export * from 'a' and I add a new variable const someVariable = 123 in a file a.js, then in a third file if I want to import the someVariable importjs won't give the the option to import it from b.js
Do things change if you give export * from 'a' a relative path? => export * from './a'. If that doesn't work, can you see if you can modify this test to reproduce? https://github.com/Galooshi/import-js/blob/017c7445d5adc71faff4a1eee1cc38beb2e2307b/lib/tests/findExports-test.js#L515
In my fork of the project I have fixed a bunch of problems including this one. All the tests are passing, but surely you will want for me to add tests which I am too lazy to learn how to do.
The problems I fixed are the following:
- specify project root
- added logic for watching files with
export * from - import computed keys in aliased desctructured constants
- proper sorting by package name/filepath with exception for React being on top
- import VALUE from obj[VALUE]
Is there a point for me to make a PR with all these changes?
Nice! I'm definitely open to reviewing these changes. When you do open a PR, can you make sure to explain each change (why it is needed, trade-offs with your implementation compared to others, etc)?
For testing, the Importer test will probably be a good target for most changes: https://github.com/Galooshi/import-js/blob/master/lib/tests/Importer-test.js
Closing this as stale.
I also could not reproduce the behavior in the first comment. Having the files below, when importing c.js I'm given the option to choose between a.js and b.js. The original problem might have been a failure to resolve a non-relative dependency.
a.js
export const someVariable = 123;
b.js
export * from "./a.js";
c.js
console.log(someVariable);