[Vite] When NX target is build
, build libs from dist folder instead of from source
#30333
tpucci
started this conversation in
Feature Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Context
A Monorepo with
vite
buildable libs.Goal
When building (
target === 'build'
) avite
application, use NX dependency graph to use buildable libsdist
output instead of building from source (current default).Consequences
With tens of libs, the application build time could benefit from previous built tasks (which are cached). Currently, those dependencies are built but are not used by the application build target.
Explanation
When using NX to generate a vite lib, the generated
vite.config.ts
file includes this plugin:Without any option, this plugin builds libs from source.
More over, there is a bug with
tsconfig-paths
which looks for anexport
field inpackage.json
. However the default generatedpackage.json
does not include an exportfield
:I think a better
vite.config.ts
generated default would be this instead:Or, option B, we could change the plugin:
Beta Was this translation helpful? Give feedback.
All reactions