N
Nuxt6d ago
bnason

Shared types/utils

There appears to be work on a common shared folder that can be imported/auto-imported via both Vue and the server at https://github.com/nuxt/nuxt/issues/28675 Is there a way to achieve this now in Nuxt3 by just updating my config? I understand the full implementation of this feature will have guards in place, but I just need a simple single location that is auto imported on both sides.
GitHub
Add #shared alias · Issue #28675 · nuxt/nuxt
Describe the feature With the new directory structure, it makes sense to have a shared/ directory for sharing constants, types and other utils between the app/ and server/` directory. After discuss...
1 Reply
bnason
bnason6d ago
So far, I've gotten this so far which works for everything except types in *.d.ts files
nitro: {
imports: {
dirs: ['./shared/types', './shared/utils'],
},
},
imports: {
dirs: ['../shared/types/**', '../shared/utils/**'],
},
nitro: {
imports: {
dirs: ['./shared/types', './shared/utils'],
},
},
imports: {
dirs: ['../shared/types/**', '../shared/utils/**'],
},
Want results from more Discord servers?
Add your server