-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Check if regex and regex.test is available before calling it #608
Conversation
@arunoda just replied. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After that, we are good to go.
@@ -11,7 +11,17 @@ const logger = console; | |||
export function addJsonLoaderIfNotAvailable(config) { | |||
const jsonLoaderExists = config.module.loaders.reduce( | |||
(value, loader) => { | |||
return value || [].concat(loader.test).some(regex => regex && regex.test && regex.test('my_package.json')); | |||
return value || [].concat(loader.test).some((loader) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you rename this loader name into something like matcher
.
Like this:
return value || [].concat(loader.test).some((matcher) => { ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@arunoda done!
Awesome. |
Trying to fix #607