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

Passing empty array is no longer possible #424

Closed
smashercosmo opened this issue Dec 11, 2019 · 6 comments · Fixed by #425
Closed

Passing empty array is no longer possible #424

smashercosmo opened this issue Dec 11, 2019 · 6 comments · Fixed by #425

Comments

@smashercosmo
Copy link

The latest release introduced breaking change (options validation). Passing an empty array is no longer possible. So it broke cases like

new CopyWebpackPlugin(condition ? ['./something'] : [])

example: https://github.com/styleguidist/react-styleguidist/blob/master/src/scripts/make-webpack-config.ts#L100

Expected Behavior

I honestly don't know if it's a valid case to support :)

@alexander-akait
Copy link
Member

Change condition [condition ? new CopWebpackPlugin() : false].filter(Boolean), it is expected empty array is not supported

@smashercosmo
Copy link
Author

Yeah, I know, that you can write it this way :) But before passing an empty array didn't trigger an error. So, technically, it's a breaking change.

@alexander-akait
Copy link
Member

Let's fix it 👍

@boutell
Copy link

boutell commented Dec 11, 2019

Watching this as it broke a number of projects, pinning temporarily to 5.0.x

@alexander-akait
Copy link
Member

In next release it will be returned and you can't use empty array

@vitalets
Copy link

vitalets commented May 25, 2020

and you can't use empty array

Why?
You can write this check once inside a plugin instead of everyone of us will write this everywhere:

[ patterns.length ? new CopWebpackPlugin({ patterns }) : false ].filter(Boolean)

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 a pull request may close this issue.

4 participants