-
-
Notifications
You must be signed in to change notification settings - Fork 758
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Experiment with using findReferencedIdentifiers to avoid extra aggressive DCE #3149
base: main
Are you sure you want to change the base?
Conversation
View your CI Pipeline Execution ↗ for commit ed5a703.
☁️ Nx Cloud last updated this comment at |
@EskiMojo14 do you have any test files to be run through? With it, we can move this PR along. |
ignoring the very large amount of conflicts caused by the recent reshuffle of the packages - I honestly don't know the right way to test this. It relies on the interplay between the two vite plugins, meaning unit testing it the way the others do isn't really possible, and it's only demonstrable by adding some code that would normally get tree shaken out. The E2E test I've added proves it works, but I have no idea how to assert that a console log showed up on the server side. |
could we instead of logging write to a file on the server in a side effect? and then in another server function return that previously written content? |
apparently not - works fine when manually executed, but in playwright the file doesn't even get created 😕 |
this is pretty messy currently, but the idea based on pcattori/babel-dead-code-elimination#34 (comment) is to find some way of getting the referenced identifiers before Start does any transformations, so it can use them when doing dead code elimination. this would mean that the only dead code that gets eliminated is any that wasn't there before Start.
I also have no idea how to test that a server side effect happened in Playwright, so that'll be a fun hurdle to cross.
from research i have basically found two "accepted" ways of communicating between plugins:
options
in one plugin and getting them out in the otherThis PR currently uses the first, because buildStart seems to be receiving an empty object in my tests.