Skip to content

feat: add ignore option to import.meta.glob#7482

Closed
brillout wants to merge 1 commit intovitejs:mainfrom
brillout:feat/glob-args
Closed

feat: add ignore option to import.meta.glob#7482
brillout wants to merge 1 commit intovitejs:mainfrom
brillout:feat/glob-args

Conversation

@brillout
Copy link
Contributor

Description

Allows the user to define the ignore option of fast-glob:

import.meta.glob('node_modules/framework/**/*.page.js', { 
  ignore: 'node_modules/framework/**/node_modules/**' 
})

I removed @frandiox's changes:

-    // Ignore node_modules by default unless explicitly indicated in the pattern
-    ignore: /(^|\/)node_modules\//.test(pattern) ? [] : ['**/node_modules/**']
+    ignore: options?.ignore ?? ['**/node_modules/**']

Because this PR makes it obsolete. AFAICT only Hydrogen is using that functionality, thus I'm not worried about the breaking change. (I don't see why a Vite end-user would want to use a gob import to search inside node_modules/.)

I will additionally ping Fran on Discord about this.

Additional context

Follow up of #7436 and more specifically #7436 (comment).

Playground confirming that this PR works as intended: https://github.com/brillout/fast-glob-playground.

What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines and follow the Commit Convention.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

@brillout
Copy link
Contributor Author

I'm closing this PR in favor of vite-plugin-glob. I'm confident vite-plugin-glob will become a Vite built-in plugin. We can re-open this PR if it doesn't.

@brillout brillout closed this Mar 30, 2022
@brillout brillout deleted the feat/glob-args branch September 18, 2024 08:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant