Closed gaurangrshah closed 3 weeks ago
@gaurangrshah Sorry for the late response!
I can't reproduce the issue from my end. Is it still an issue? If yes, do you have a demo project for me to test?
Thanks!
Sorry I don't we ended up defaulting to using prettier to sort the imports. I'll see if i can pull it into another next.js project and reproduce.
We (and all of our students) have been using the JS/TS Import/Export Sorter VS Code extension since over a year with various Next.js projects since use client
support and use server
support were published, and we have never seen a problem with support.
In the original video, the directive is written incorrectly: 'use-client'
instead of 'use client'
.
So I'm guessing that this was caused by this typo (or misconfiguration or conflict with another extension) and the issue can be closed.
Describe the bug This bug on started happening recently after months of use with the extension.
In a next.js / react 18 application placing a "use client" directive at the top of the page usually was ignored by the sorter, but now it seems to be sorting it incorrectly placing it at the bottom of the import list.
To Reproduce Create a react client component, add a few imports, and place the "use client" directive at the top of the page. And save the document.
FYI: Oddly enough it still ignores the "use server" directive accordingly.
Expected behavior "use client" should be preserved at the top of the page.
Screenshots
OS (please complete the following information):
VS Code (please complete the following information):
package.json (please remove any sensitive info)
tsconfig.json (if any)
.prettierrc/.prettierrc.js/prettier.config.js/.prettierrc.toml (if any) filename:
.editorconfig (if any)
Installed VS Code extensions [Execute
$ code --list-extensions
in terminal to get the list. How to run VS Code from terminal in MacOS]