Mark @rei/cdr-tokens
as external
#188
Merged
+17
−14
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.
Problem
I see an SSR runtime exception from Nitro (Nuxt) derived from dead references in
@rei/cedar
's distributed modules. When Nuxt builds the application (nuxt build
), it outputs optimized server assets to.output/server,
where you'd run a productionized Nuxt app from.The Nuxt build heuristics exclude nested
node_modules
directories, instead hoisting them to the top-level.output/server/node_modules
. However, some@rei/cedar
modules are dependent on those modules existing in a relative location:This causes the following Nuxt/SSR runtime exception:
In the context of the Alpine ecosystem, this hasn't been a problem because our processes use a customized SSR setup that copies
node_modules
into the Crampon SSR sidecar (docker container).Solution
This PR marks
@rei/cdr-tokens
as external, so the build system doesn't bundle them into the@rei/cedar
distributed modules. Instead, Cedar modules will directly reference@rei/cdr-tokens
fromnode_modules
at run-time, which should be the expected behavior.Side-effects
With
@rei/cdr-tokens
externalized, we need to adjust module entry points for@rei/cedar
, as Vite no longer outputs.dist/src
. Those entry points will live in.dist/
, thus, we update references inpackage.json
. Additionally, module references to@rei/cdr-tokens
are updated to match.