quiet-wolf-18467
index.ts
to define all resourcesindex.ts
? I don't feel I have much control over the repository hygeinewhite-balloon-205
import
implementation details into the places they are needed.
This doesn't have to align 1:1 with components - though sometimes that will make sense.
But if the implementation of a component is very large, you can split it into several files and then import those details into the module that actually implements the component.
One common pattern is to move the component (or area of functionality generally) into a folder, and put an index.ts
in there that exposes the "API" for that area of functionality, and imports details from other files within that folder.quiet-wolf-18467
.ts
files, what should be set as main:
inside package.json
?white-balloon-205
main:
.
Do you have an example of the kind of thing you'd like to work but that doesn't?quiet-wolf-18467
index.ts
would need to import all resources from other files, only to export them again; is that correct?white-balloon-205
quiet-wolf-18467
white-balloon-205
export * from “./other”
For each of the files you want to include in your stack exports. Do you just not like having this additional file? The benefit of this file is that it makes clear what you intended to be the stack outputs in one place, vs just having exports spread throughout your files. This also generally makes the other files more reusable in other contexts where they may be used as part of a project with different stack exports.
Definitely would be interested to see a concrete example of the pattern you are using that is causing this to be problematic to understand what we could do to help.quiet-wolf-18467
export *
syntax, that's perfect. Thank you for your continued patience and help!