Skip to content
This repository has been archived by the owner on Jul 27, 2021. It is now read-only.

Webpack error added (in order to be able to show Stylelint errors) #52

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

iceekey
Copy link

@iceekey iceekey commented May 27, 2017

No description provided.

@DorianGrey
Copy link

Note: There is a major difference between this PR and your original proposal here, in isWebpackError.

Original version:

function isWebpackError (e) {
  return _.isEmpty(e.originalStack) && _.isNil(e.file) && _.has(e, "webpackError");
}

The one in this PR:

function isWebpackError (e) {
  return !Array.isArray(e.originalStack) && e.hasOwnProperty('webpackError');
}

These are not semantically equivalent: The latter would fail if e.originalStack is an empty array, and succeed even if e.file is defined.

I've tested both versions and the latter does not seem to work due to the issue with e.originalStack - at least for stylelint.

Note that the lodash-free equivalent of your original proposal would be:

function isWebpackError(e) {
  return (!Array.isArray(e.originalStack) || !e.originalStack.length) && (e.file == null) && e.hasOwnProperty("webpackError");
}

Which works fine, although I'm not sure if the second condition is still relevant.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants