Skip to content
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

fix(atomizer-plugins): run atomizer on file updates #553

Merged
merged 7 commits into from
Dec 6, 2022

Conversation

redonkulus
Copy link
Contributor

I confirm that this contribution is made under a BSD license and that I have the authority necessary to make this contribution on behalf of its copyright owner.


Fixes the atomizer-unplugin library to run atomizer on application file updates. Code copied from @maheshbansod investigation.

@changeset-bot
Copy link

changeset-bot bot commented Dec 5, 2022

🦋 Changeset detected

Latest commit: 795b9a6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
atomizer-plugins Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Dec 5, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
acss-site ✅ Ready (Inspect) Visit Preview Dec 5, 2022 at 7:05PM (UTC)

@maheshbansod
Copy link
Contributor

@redonkulus in my project, I'm planning to make this so that writeFile in transform will invoke during dev mode only - without the dev mode flag, transform will exit early and buildEnd will do the writeFile.
I think this will make build faster, since it doesn't have to update the file on every transform.

@redonkulus
Copy link
Contributor Author

redonkulus commented Dec 5, 2022

@maheshbansod how will you implement the dev mode flag, NODE_ENV=development?

Will you keep the transformIndexHtml hook as well as buildEnd? I think if you move it off of transform then the debounce may not be needed after all.

I misread your original comment, I think you were saying that you will only change to buildEnd when the dev flag is not passed in?

@redonkulus
Copy link
Contributor Author

redonkulus commented Dec 5, 2022

@maheshbansod I've added the dev flag check using NODE_ENV since vite already uses that standard. So now it will only call writeFile() in dev mode and leave writing to file in production for buildEnd.

@maheshbansod
Copy link
Contributor

@redonkulus I was thinking of sending the dev flag via the options parameter but this way looks good.

@redonkulus
Copy link
Contributor Author

Ok please test this out locally. I will merge and release tomorrow. Thanks!

@maheshbansod
Copy link
Contributor

@redonkulus tested the code on my side in a Vite plugin. working well.

@redonkulus redonkulus merged commit 4799c0a into main Dec 6, 2022
@redonkulus redonkulus deleted the fix-unplugin-vite branch December 6, 2022 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants