Appearance
Set all peer- and dependencies as external
Status: Approved
Decision Date: 15/12/2022
Scope: codey-components, codey-composables
Context
Considering Limit vite rollup externals to peer and Xerius packages for context and further research on how to handle externals. The following discussion helped to clarify the use of external property within libraries.
Decision
Externalize all peer & dependencies.
The following plugin can handle this for us rollup-plugin-node-externals
. But as mentioned in the discussion above, there is an issue regarding integration with vite. This is why vite-plugin-externalize-deps
is created within the internal-node
library. As the change required is minimum, it seems best to keep this within our own control until a proper fix is available within the original plugin.
Consequences
All used dependencies will be externally added when the consuming application is performing its build. This has the big advantage that code optimization can be handled correctly when the consumer uses the same library as one of our libraries.
This outweighs potential risk of version mismatch in usage.
Alternatives
The alternative would be the stricter approach described in Limit vite rollup externals to peer and Xerius packages. But because of the great drawback of potentially bundling the same lib multiple times it is not preferred.