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

Exclude /.idea/workspace.xml #4325

Closed
1 task
ivoba opened this issue Aug 15, 2022 · 13 comments
Closed
1 task

Exclude /.idea/workspace.xml #4325

ivoba opened this issue Aug 15, 2022 · 13 comments
Labels
- P2: nice to have Not breaking anything but nice to have (priority)

Comments

@ivoba
Copy link

ivoba commented Aug 15, 2022

What version of astro are you using?

1.0.5

Are you using an SSR adapter? If so, which one?

no

What package manager are you using?

npm

What operating system are you using?

Linux

Describe the Bug

When working with IntelliJ Ultimate the watcher keeps updating workspace.xml.

09:20:00 [astro] update /.idea/workspace.xml

Can this be excluded as this is a metafile of IntelliJ and not relevant for the project?

Link to Minimal Reproducible Example

https://stackblitz/none

Participation

  • I am willing to submit a pull request for this issue.
@matthewp
Copy link
Contributor

Can't you just add this file to your .gitignore file?

@ivoba
Copy link
Author

ivoba commented Aug 15, 2022

@matthewp what i mean was that astro watches the .idea/workspace.xml file.
Not that it edits or updates the file. That was maybe misleading.

I would like to exclude this file from the watcher since it is not relevant for rerendering or hotloading.

@matthewp
Copy link
Contributor

@ivoba got it, does the fact that it is watching this file cause any sort of problems?

@ivoba
Copy link
Author

ivoba commented Aug 15, 2022

@matthewp not really. It just might cause some unnecessary rebuilds.
The display just confused me since it is not a source file per se.

@matthewp
Copy link
Contributor

matthewp commented Aug 15, 2022

Maybe we should not be watching files/folders that start with .. Pinging @bluwy as he might have encountered this request in Vite before.

@natemoo-re natemoo-re added the - P2: nice to have Not breaking anything but nice to have (priority) label Aug 15, 2022
@bluwy
Copy link
Member

bluwy commented Aug 15, 2022

We should still keep watching files that start with ., e.g. SvelteKit that generates files under .svelte-kit that are imported in user code. I think the better way, since this is a nice-to-have, is to configure files to exclude watching through vite.server.watch.ignored.

@matthewp
Copy link
Contributor

Ah, good point. @ivoba you can configure this in your astro.config.mjs like this:

import { defineConfig } from 'astro/config';

export default defineConfig({
  vite: {
    server: {
      watch: {
        ignored: ['.idea/workspace.xml']
      }
    }
  }
}

Going to close for now, if enough people run into this being a problem for them we might add it as a default in the future.

@ivoba
Copy link
Author

ivoba commented Aug 16, 2022

Thanks that was what i was looking for.
I added but however it seems it has no effect.

@Dragonlord1005
Copy link

Dragonlord1005 commented Oct 29, 2022

Thanks that was what i was looking for. I added but however it seems it has no effect.

import { defineConfig } from 'astro/config';

export default defineConfig({
  vite: {
    server: {
      watch: {
        ignored: ['**/.idea/workspace.xml']
      }
    }
  }
}

This should fix it

@rshurts
Copy link

rshurts commented Mar 29, 2023

You may as well cover everything in the .idea folder:

vite: {
  server: {
    watch: {
      ignored: ['**/.idea/**']
    }
  }
}

@kaorukobo
Copy link

@rshurts This worked perfectly for me, thanks. ...while it is curious that just ignored: ['.idea/**'] does not work.

@FDiskas
Copy link

FDiskas commented Jul 11, 2023

I would say - everything that is inside the .gitignore file, should also be ignored.

@fwextensions
Copy link

fwextensions commented Aug 24, 2023

It would be nice if this solution were more discoverable. I had to try several different search queries to find this one issue. Then I went back to the config docs to see if I'd missed something, but watch doesn't appear on that page, and ignore only in the context of trailing slashes. And you'd have to go several pages into the Vite docs to find the right option.

Also, for some reason, just adding a path like "foo.md" or "./foo.md" to the ignored list didn't do anything. Saving that file would always cause a rebuild, even though the file's at the top level of the project.

For anyone else running into the same problem, this ended up working (no idea why it's necessary):

vite: {
  server: {
    watch: {
      ignored: [
        '**/.idea/**',
        '**/foo.md'
      ]
    }
  }
}

Obviously, that will probably mess things up if you ever have a foo.md file in your project, but in my case, it's unlikely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P2: nice to have Not breaking anything but nice to have (priority)
Projects
None yet
Development

No branches or pull requests

9 participants