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

Add just the necessary files to rollup watch mode #2007

Merged

Conversation

vstefanovic97
Copy link
Contributor

I noticed when working on a v2 addon that it was considering all files inside src for watch mode.

This is not ideal, as in some cases we want to have exclusions, eg. if we have something (eg postcss-d-ts) that generated type declaration files for our css we don't want to have those files included in watch mode or else they will trigger infinite re-builds.

Made the change so we explicitly add only the files we need

@@ -14,12 +14,6 @@ export default function keepAssets({
return {
name: 'copy-assets',

// Prior to https://github.com/rollup/rollup/pull/5270, we cannot call this
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I can see this issue got resolved

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They have a nifty bot that tells you what version of rollup includes the PR 🎉 apparently this was fixed in [email protected].

I wonder if we have any peer dependency reference or anything that would allow us to say which versions of rollup are supported 🤔

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also if we are changing the "rollup support matrix" this one change could technically make this a breaking change... maybe 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mansona that is a good point, I can add rollup as a peerDep to @embroider/addon-dev's package.json file if you feel like that is the right approach?
And it might we a major release, if we take that into account?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mansona looks like all the rollup maintained plugins include rollup as a peerDep
Like for example here in @rollup/babel, so I guess this would be the way to go
https://github.com/rollup/plugins/blob/master/packages/babel/package.json#L58

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so the fact that rollup does it really makes me feel like we should do the same thing. And we need to declare the minimum version of rollup that we support

if you want to go ahead and add that in this PR we can mark it as breaking and it will automatically get picked up and released correctly 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mansona I added the change, take a look when you can

@@ -16,14 +16,14 @@ export default function publicEntrypoints(args: {
return {
name: 'addon-modules',
async buildStart() {
this.addWatchFile(args.srcDir);

let matches = walkSync(args.srcDir, {
globs: [...args.include, '**/*.hbs', '**/*.ts', '**/*.gts', '**/*.gjs'],
ignore: args.exclude,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now it will take into account exclude option and exclude files from watch mode as well

@NullVoxPopuli NullVoxPopuli added the enhancement New feature or request label Jun 26, 2024
@mansona mansona added breaking and removed enhancement New feature or request labels Jun 26, 2024
Copy link
Collaborator

@simonihmig simonihmig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

We do have addon-dev watch tests that would detect regressions, right? Or does this warrant some more manual testing?

@mansona
Copy link
Member

mansona commented Jun 27, 2024

@simonihmig yea I'm happy this is covered 👍 LGTM

@mansona mansona merged commit 9c22cab into embroider-build:stable Jun 27, 2024
203 checks passed
@github-actions github-actions bot mentioned this pull request Jun 27, 2024
@vstefanovic97
Copy link
Contributor Author

Thank you @mansona, @void-mAlex, @NullVoxPopuli , @simonihmig for the reviews and merging this so quickly!

@simonihmig
Copy link
Collaborator

Thanks for your contribution! 👍🎉

@patricklx
Copy link
Contributor

I do not think this was correct. Now it does not detect new files added to the src folder

@patricklx
Copy link
Contributor

I think the right solution would have been to either setup watch exlcude or watch include
https://rollupjs.org/configuration-options/#watch-exclude

patricklx added a commit to patricklx/embroider that referenced this pull request Jul 10, 2024
patricklx added a commit to patricklx/embroider that referenced this pull request Jul 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants