-
-
Notifications
You must be signed in to change notification settings - Fork 209
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
fix(index): runaway promise #269
fix(index): runaway promise #269
Conversation
@mcjfunk I which usecases does this occur? It might not throw, but looks odd tbh :). e.g the current file would be lost then right? |
Using the configuration below running the
There is no promise warning outside of the 'webpack-dev-middleware` workflow. With (and without) the fix, the styles are correctly processed and injected onto the page. The fix quiets down the promise warning that happens on every less file it processes. Looks like others have had to implement a similar fix: Thanks! |
@mcjfunk seems related to |
I won't have a chance to put together a test repo anytime soon :(. I tried a test with a CSS file instead of less, and removed the less-loader. The warnings were still present. When I remove the |
I need a reproducible case for this to land it in |
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.
Just a note for now, in case we need it
@@ -165,7 +165,7 @@ module.exports = function loader (css, map) { | |||
* @param {String} result Result (JS Module) | |||
* @param {Object} map Source Map | |||
*/ | |||
return cb(null, `module.exports = ${JSON.stringify(css)}`, map) | |||
return cb(null, `module.exports = ${JSON.stringify(css)}`, map) || null |
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.
cb(null, `module.exports = ${JSON.stringify(css)}`, map)
return null
@@ -175,7 +175,7 @@ module.exports = function loader (css, map) { | |||
* @param {String} css Result (Raw Module) | |||
* @param {Object} map Source Map | |||
*/ | |||
return cb(null, css, map) | |||
return cb(null, css, map) || null |
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.
cb(null, css, map)
return null
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.
I'm working on a React app that spits out a long string of broken promise warnings every time I build, and either of these two fixes makes them all go away.
Seems like a trivial fix to a constantly annoying problem.
Please merge one or the other. Thank you.
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.
@DmitriWolf Are you also using bluebird
?
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.
We are!
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.
Simple fix, looks good!
@@ -175,7 +175,7 @@ module.exports = function loader (css, map) { | |||
* @param {String} css Result (Raw Module) | |||
* @param {Object} map Source Map | |||
*/ | |||
return cb(null, css, map) | |||
return cb(null, css, map) || null |
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.
I'm working on a React app that spits out a long string of broken promise warnings every time I build, and either of these two fixes makes them all go away.
Seems like a trivial fix to a constantly annoying problem.
Please merge one or the other. Thank you.
Returning Previous versions (1.3.3 f.e.) returned |
Released in v2.0.7 |
I'm getting a runaway promise warning:
Seems that the loader returns undefined in certain situations, falling back to null fixes it and seems to be the recommended practice from the Bluebird docs: http://goo.gl/rRqMUw
There was a similar fix, about a year ago. #95