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

Use rollup's addWatchFile API to mark dependencies #1696

Merged
merged 1 commit into from
Dec 11, 2023

Conversation

chancancode
Copy link
Contributor

This solves a bunch of watch-mode (not) rebuilding issues; as a general rule everytime we probe or read from the file system we should at least consider whether such an annotation is needed.

Unfortunately this package doesn't appear to be tested currently, but I have applied the same patch locally and it appears to be working fine.

If someone has the bandwidth to set up new tests for this package (similar to https://github.com/embroider-build/embroider/blob/main/tests/scenarios/watch-mode-test.ts), I am happy to add the regression tests, but otherwise it probably shouldn't block landing this, I don't think it's making things worse.

@chancancode
Copy link
Contributor Author

One example of the issue this fixes is that, currently, in a v2 addon, if you add a new file in the src folder after the initial build, it won't be picked up by rollup at all until you restart the build.

chancancode added a commit to chancancode/discourse that referenced this pull request Dec 5, 2023
@ef4
Copy link
Contributor

ef4 commented Dec 5, 2023

Based on your comments it look like this probably bumps the minimum supported rollup version? That would be OK but we should document it and consider whether this should be a semver major of @embroider/addon-dev.

@SergeAstapov
Copy link
Collaborator

if this end up requiring major, may be bundled with #1697

chancancode added a commit to chancancode/discourse that referenced this pull request Dec 5, 2023
@chancancode
Copy link
Contributor Author

No it would if we had wanted to call it inline in generateBundle, but that’s why I split it out

@chancancode chancancode changed the base branch from main to stable December 5, 2023 16:15
@ef4
Copy link
Contributor

ef4 commented Dec 5, 2023

chancancode added a commit to chancancode/embroider that referenced this pull request Dec 5, 2023
Ran into bugs/issues with using polling mode when writing tests for embroider-build#1696, specifically that on my macOS dev environment using polling, when watching a directory it doesn't seem to consistently emit the `added` event. 

Mainly I wanted to see which, if any, tests fail without this option. It also seemed a bit suspect since rollup/chokidar presumably works on windows out of the box? 

Even if this is necessary we may want to limit it to the windows test only (can just set `CHOKIDAR_USEPOLLING` on the job level), since this makes things _less_ realistic everywhere else.
chancancode added a commit to chancancode/embroider that referenced this pull request Dec 5, 2023
Ran into bugs/issues with using polling mode when writing tests for embroider-build#1696, specifically that on my macOS dev environment using polling, when watching a directory it doesn't seem to consistently emit the `added` event.

Mainly I wanted to see which, if any, tests fail without this option. It also seemed a bit suspect since rollup/chokidar presumably works on windows out of the box?

Even if this is necessary we may want to limit it to the windows test only (can just set `CHOKIDAR_USEPOLLING` on the job level), since this makes things _less_ realistic everywhere else.

(cherry picked from commit a562b4e)
chancancode added a commit to chancancode/embroider that referenced this pull request Dec 6, 2023
This solves a bunch of watch-mode (not) rebuilding issues; as a
general rule everytime we probe or read from the file system we
should at least consider whether such an annotation is needed.

Unfortunately this package doesn't appear to be tested currently,
but I have applied the same patch locally and it appears to be
working fine.
@chancancode
Copy link
Contributor Author

I couldn't get the test to work on CI so I split it out into #1711

@ef4 ef4 merged commit dfb37f6 into embroider-build:stable Dec 11, 2023
201 checks passed
@chancancode chancancode deleted the add-watch-file branch December 12, 2023 01:57
@mansona mansona added the bug Something isn't working label Dec 12, 2023
This was referenced Dec 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants