Closed nick-stebbings closed 12 months ago
I don't think I see the point in this repo tbh. extends
yes, references
not so much. It's Storybook and Vite that are handling all the building and linking during development so everything happens within that single compilation pipeline. The different packages aren't considered "different" except when they're being packaged for publication.
Current blocker is to do with this guarantee:
Prepending a project will include the project’s output above the output of the current project. All output files (.js, .d.ts, .js.map, .d.ts.map) will be emitted correctly.
:unamused: lies
Hmm.
npx tsc -b
seems to fail without being able to infer the imports in design-system-imports.stories.ts
. The package references seem to be referenced totally fine by PNPM so far as I can see. The result is the same no matter which directory the command is run from, which implies to me that the composite
and references
are functioning as intended or we wouldn't be seeing consistent behaviour when executed from various working directories.
I have also tried with this workaround for manually specifying compilation output paths and having a separate build & watch script for each module that generates a locally-adjacent design-system/dist
& dev-util/dist
. Such an arrangement only partially works- when I cd design-system && npx tsc -p ./tsconfig.json
I get a different strange set of failures resulting in some components missing. The indicator of this in the linked issue as a non-deterministic ordering bug in TypeScript's dependency resolution algorithm seems to confirm what I'm seeing. There are indicators that it's been resolved before, but idk, I'm hitting something weird.
I also tried referencing build artifacts outside of each module's package.json
root but that was a silly idea.
Regardless, if I am reading the docs right these experiments feel like measures of desperation to inefficiently kludge around what project references are supposed to achieve?
It is also entirely possible that Storybook just doesn't play well with the TypeScript compiler in composite
mode and that there are upstream bugs to be addressed there. It's quite probably running the Vite build process with the equivalent of tsc -p ./tsconfig.json
rather than tsc -b
.
Sure wish I'd actually pushed that yesterday :joy: sorry @nick-stebbings
Completed in #11
See https://www.typescriptlang.org/docs/handbook/project-references.html