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 imported files not causing watch mode updates #22

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zqianem
Copy link

@zqianem zqianem commented Jan 2, 2023

When using vite or rollup --watch, editing a shader file that is only imported by another shader file via glslify doesn't trigger a rebuild. This PR fixes that. See vitejs/vite#1614 (comment).

There is some duplication caused by inlining the compile function from glslify, which is required to keep supporting the glslify API options mentioned in this project's README. We can coordinate with the glslify repo to remove this duplication in the future.

This fix only takes effect if addWatchFile works, i.e. Vite >=4 or Rollup not on Linux.

Inlines the `compile` function from glslify with a modification to also
return dependencies so they can be passed to `addWatchFile`
@pschroen pschroen self-assigned this Jan 5, 2023
@pschroen
Copy link
Member

pschroen commented Feb 2, 2023

Related discussion:
rollup/rollup#3414 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants