-
-
Notifications
You must be signed in to change notification settings - Fork 5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(schema,nuxt): add shared
folder to alias and auto-imports
#28682
base: main
Are you sure you want to change the base?
Conversation
Run & review this pull request in StackBlitz Codeflow. |
shared
folder to alias and auto-imports
b9356a1
to
3114d48
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great!
The next step is to configure import protection so that we do not use certain protected imports in that folder...
What do you mean? I never heard this term before. Do you have an example? Edit Oh, you mean, protecting against unwanted imports like vue / nitro related stuff within the |
You can add patterns for the shared directory here: nuxt/packages/nuxt/src/core/plugins/import-protection.ts Lines 12 to 52 in 77e36ee
Or let me know, and I'll happily implement. 🙏 |
Thanks to @manniL I could push a new plugin with a different |
I'm facing another issue. Everything in the |
Is there anything in |
🔗 Linked issue
fix #28675
📚 Description
Hello 👋,
This PR adds:
#shared
alias to bothtsconfig.json
andtsconfig.server.json
#shared/types
and#shared/utils
inapp
andserver
directoriesThe second bullet point is still in progress because I'm still trying to understand the usage of unimport within the project.So, after talking with @danielroe, this
#shared
folder is more complicated than expected. Here a list of expected behavior (that needs to be implemented)./app
folder can import (and auto-import) from the./shared
folder./server
folder can import (and auto-import) from the./shared
folder./shared
folder, you should not be able to import stuff from both./app
and./server
(could be achieved by excluding the file from thetsconfig.json
and a single chunk could be created)./shared
folder, you could (we need to decide if we want or not this behavior) import and auto-import stuff from the./shared
folder.At the end, the shared folder is just for pure JS (or TS) stuff. Nothing have to be related to Vue or Nitro.