native: import directly from shared src instead of bundle #4120
+608
−672
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
pnpm run dev:shared
is no longer necessaryshared
will now trigger a (working) reload of the app – no moreunexpected undefined
@tloncorp/shared/dist/*
is no longer allowed: imports of those subpackages must now be (1) declared in theexports
inshared/package.json
, and (2) imported using the alias fromexports
, e.g.@tloncorp/shared/db
.All packages typecheck and build, but some tests are failing – e.g.
packages/shared/src/db/queries.test.ts
.Error: Expected ';', '}' or <eof>
.and those are only the cycles reachable from that file. gist
packages/shared/src/urbit/channel.ts -> packages/shared/src/urbit/content.ts
) requires large careful code movement to fix (or maybe just merge the two files? I think I don't have context on the organization here)I don't have a great understanding of why this is newly a problem: my guess is that we were kind of "dynamically importing" the bundled code when running tests previously (i.e. each file in the bundle had a dynamic
require
to another file in the bundle): since we're now doing "static imports" and need to resolve dependencies up front (to make an esm bundle?), Vitest's Rollup is blowing up at the cycles.I think the main change in DX around skipping bundling
shared
was good enough here to open this PR; I'm going to look for workarounds on the dependency cycle issue; but we should really try to remove these cycles, as I think they are preventing more efficient bundling and potentially causing ghostly bugs.