Wrong import path when copy/pasting JSX between components

I have 3 React components, all in separate files with default export

- Component1.js

- Component2.js

- SharedComponent.js

 

If I include SharedComponent in Component1 with auto-completion, the correct import is automatically added :

 

But if I copy/paste ths JSX containing <SharedComponent> into Component2, the wrong import is generated :

Component1.js :

Component2.js :

This bug happen whatever the depth and complexity of the JSX copied, as long as it contained one imported component.

 

This is clearly a bug. At no point any JSX copied from one file should be considered the defautl export from that file. A the very least in this case, no import should be generated.

Please sign in to leave a comment.