kylyi
kylyi
NNuxt
Created by kylyi on 3/9/2025 in #❓・help
Layers architecture and performance
I'm using a simple monorepo to separate the code:
pnpm-workspace.yaml
packages:
- 'libs/*'
- 'apps/*'
- 'layers/*'
pnpm-workspace.yaml
packages:
- 'libs/*'
- 'apps/*'
- 'layers/*'
In layers, I have the "common" stuff, like Utilities (consisting of functions, constants, ...) and UI (consisting primarily of components). layers may use each other, for example, UI uses Utilities layer. Then I have the libs, which are technically also nuxt layers. Each lib has its own components, its own API handlers and so on. libs can use layers but cannot use other libs - if a lib requires another lib, it just imports stuff from the lib directly (or actually through alias) And lastly, there are apps which use the layers and libs to create something actually usable for the end-user. Now, some apps may use 10+ layers and those layers can reuse each other and so on. Therefore, the generated tsconfigs and typescript-related stuff is really heavy. Also, when I use the vue-tsc in some lib, I expect only the lib to be checked, but currently the used layers are also checked. How do I go about this?
5 replies
NNuxt
Created by kylyi on 2/17/2025 in #❓・help
Partial autoimport from layers
I am trying to build an app that uses multiple layers. For some layers, I would like to turn off the implicit autoimported dirs (./composables, ./utils) Let's have the following example:
File structure
- apps
- app1

- packages
- layer1
- composables
- useStuff1.ts
- layer2
- useStuff2.ts
- apps
- app1

- packages
- layer1
- composables
- useStuff1.ts
- layer2
- useStuff2.ts
I would like the useStuff1 to be autoimported, while useStuff2.ts not. Is that currently possible?
10 replies