Closed mhamri closed 1 year ago
Hey @mhamri, sorry if I was not clear before. The tutorial I linked may have been geared towards angular, but the concepts it goes over are related to what you are seeing. Most of our bundler executors default to building the library code from source, for a variety of reasons which other people would be more versed to explain.
Regardless, if you do not wish for the bundler to build the library from source, and would rather it build from dist which can make sense in some use cases, most of our executors accept an option buildLibsFromSource
. This is what I was referring to as the angular tutorial covers it.
See:
It doesn't look like those options are currently supported for esbuild and rollup, if you need to consume libraries from dist and a parent project is using either of those you should open a feature request to support it. Either way, the consuming app in your repo does use vite, which supports the option, so passing it should resolve the issue you are describing.
@AgentEnder is it possible to not close the issue until we have a clear resolution?
I've tried what you've suggested and it didn't work
1- added another vite project with @nx/js
2- added the plugin to replace the text __IsVite2__
in the second project
3- use the first vite project inside the second project 4- set build from source in both vite project to false
vite
vite 2
5- make build files and as you can see, previous build steps isn't used
6- tried it with node. changed the node app to use vite2
7- serve the node and only for the first level lib the plugin is applied
8- build node app and for both lib the build is didn't applied
@AgentEnder still I'm waiting for your response
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.
Current Behavior
I'm reopening #19404 since I believe unfortunately @AgentEnder didn't spend time and closed the issue without understanding the main problem (Irony of his username)
the issue is the build results, not angular (against @AgentEnder understanding)
builds are not using previous build step result. having a rollup next to vite next to esbuild means nothing in nx mono repo. main question is
because if it's not for the sake of caching and build-once-use-many, using npm's workspace would be more wise.
I have created a repository that shows when the target build is a vite project or rollup project or an esbuild project. previous build step isn't used in the next build step.
to be clear that "the issue isn't about angular" I've removed the angular application from the repository!
Expected Behavior
build once, use multiple times. each build step should use previous build result. helps to decrease build effort and memory usage.
GitHub Repo
https://github.com/mhamri/Bundling-Issues-in-Nx
Steps to Reproduce
by here you can stop, you already saw that build is broken but if you want to test more
add a nodejs project with @nx/node
call viteToRollup()
see output
Nx Report
Failure Logs
No response
Package Manager Version
pnpm 8.9.0
Operating System
Additional Information
No response