Open cndlhvn opened 7 years ago
This is unfortunate. It has to do with the cache being cold. On first use, import-js will kick off a background thread indexing modules in your project structure. So on first use, the cache is empty. On the second try, the cache has been populated.
I'm not happy with how this UX ended up like. Due to some technical decisions made along the way, it's a little tricky to know when the cache is done. If you have ideas for how to solve this, I'd be happy for some input!
The cli tool is somewhat unusable before you've populated the cache. The background thread will kick off as usual when the cache is empty, but due to how the command immediately finishes, the thread will usually be cancelled right away.
I use node 6.5.0 and import-js 2.2.0
I'm trying to insert component path to React file. This is the my react project structure.
I want to insert Button component path to the src/App.js This is the code of Button.js
I run this command in the application root dir.
importjs word Button src/App.js
And I caught this message. {"messages":["No JS module to import for
Button
"],"f... Import-js can't find out the Button component.Next, I open the src/App.js with Atom editor. I type Cmd+Shift+j two times. There are two messages.
"No JS module to import for Button" "Importd ./components/Button"
After that, I run the command again.
importjs word Button src/App.js
I caught this message. {"messages":["Imported
./components/Button
"],"fi...Import-js could find out the Button component. Why did not import-js find the button component before that?