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

consider to give a option to override watch folders? #5023

Closed
4 tasks done
4-1-1 opened this issue Sep 22, 2021 · 4 comments · Fixed by #5239
Closed
4 tasks done

consider to give a option to override watch folders? #5023

4-1-1 opened this issue Sep 22, 2021 · 4 comments · Fixed by #5239
Labels
documentation Improvements or additions to documentation

Comments

@4-1-1
Copy link

4-1-1 commented Sep 22, 2021

Clear and concise description of the problem

wanna to watch external folder or node_modules/xx .

  const { ignored = [], ...watchOptions } = serverConfig.watch || {}
  const watcher = chokidar.watch(path.resolve(root), {
    ignored: [
      '**/node_modules/**',
      '**/.git/**',
      ...(Array.isArray(ignored) ? ignored : [ignored])
    ],
    ignoreInitial: true,
    ignorePermissionErrors: true,
    disableGlobbing: true,
    ...watchOptions
  }) as FSWatcher

https://github.com/vitejs/vite/blob/main/packages/vite/src/node/server/index.ts#L321-L332

Suggested solution

add something like rootPaths , to watch options .

Alternative

No response

Additional context

No response

Validations

@haoqunjiang
Copy link
Member

What's the use case?

@4-1-1
Copy link
Author

4-1-1 commented Sep 23, 2021

@sodatea My project use a private npm package, so i need to watch specific package in node_modules.

@haoqunjiang
Copy link
Member

Could you try negated glob patterns to see if it overrides the default ignored patterns?
Something like ignored: ['!**/node_modules/**']

@haoqunjiang
Copy link
Member

I just tested and it worked.

So let's just add a note in the documentation instead of adding a new option.

@haoqunjiang haoqunjiang added documentation Improvements or additions to documentation and removed enhancement: pending triage labels Oct 8, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Oct 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants