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

gitignore option incompatible with objectMode option #145

Closed
alexander-akait opened this issue Jun 3, 2020 · 1 comment · Fixed by #157
Closed

gitignore option incompatible with objectMode option #145

alexander-akait opened this issue Jun 3, 2020 · 1 comment · Fixed by #157

Comments

@alexander-akait
Copy link

Reproducible example:

const paths = await globby(
  '/path/to/directory/**/*', 
  {
    objectMode: true,
    gitignore: true
  }
);

console.log(paths);

Output:

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type object

  at ensureAbsolutePathForCwd (node_modules/globby/gitignore.js:48:11)
  at p (node_modules/globby/gitignore.js:60:55)
  at arrayUnion.filter.path_ (node_modules/globby/index.js:135:47)
    at Array.filter (<anonymous>)
  at module.exports (node_modules/globby/index.js:135:30)

@gregbenz
Copy link

This same issue seems to be affecting copy-webpack-plugin (per @evilebottnawi: webpack-contrib/copy-webpack-plugin#496). Results in webpack error at build: "ERROR in The "path" argument must be of type string. Received an instance of Object" (the error does not anything beyond that to find the source of the failure).

The following plugins options in webpack.config.js will fail when gitignore is true:

plugins: [
	new CopyPlugin({
		patterns: [
			{
				from: './', 
				to: '../dist/',
				context: './src/',
				globOptions: {
					dot: true,
					gitignore: true, //In "copy-webpack-plugin": "^6.0.3", causes: ERROR in The "path" argument must be of type string. Received an instance of Object
					ignore: ['**/*.ts', '**/*.tif*', '**/*.tif', '**/*.md', '**/*.js', '**/libs/**', '**/*.doc'],
				},
			},
		],
	}),
],

Airkro added a commit to best-shot/copy-webpack that referenced this issue Sep 8, 2020
Airkro added a commit to best-shot/best-shot that referenced this issue Sep 8, 2020
LKummer added a commit to LKummer/globby that referenced this issue Dec 31, 2020
Add tests where gitignore and objectMode are used together, for sindresorhus#145.
LKummer added a commit to LKummer/globby that referenced this issue Dec 31, 2020
Fix objects being passed as paths when objectMode is enabled by using
the path property if defined.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants