-
-
Notifications
You must be signed in to change notification settings - Fork 2.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
[Fix] Prevent build from breaking when .scss file is empty #1193
Conversation
Just noticed the same with .less files. Do you want to fix that also? I could submit a PR to your repo if you are busy :) |
@gnijuohz Thanks for the heads up, I fixed it! |
Codecov Report
@@ Coverage Diff @@
## master #1193 +/- ##
==========================================
+ Coverage 85.59% 88.45% +2.86%
==========================================
Files 77 77
Lines 4310 4105 -205
==========================================
- Hits 3689 3631 -58
+ Misses 621 474 -147
Continue to review full report at Codecov.
|
@crhayes great! I was about to submit a PR to your repo haha. Thanks! |
@@ -33,7 +33,7 @@ class LESSAsset extends Asset { | |||
return [ | |||
{ | |||
type: 'css', | |||
value: this.ast.css, | |||
value: this.ast ? this.ast.css : '', |
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.
You could fallback to this.contents
instead of an empty string, it would end up being the same though. Might be faster as you have it right now.
Would only be really useful if ast can ever be undefined/null while content is not.
I was attempting to set up my build with SASS according to the guides. In order to get the build working as quickly as possible I created an empty
app.scss
file and imported it into my main module. I expected the build to complete, but instead received this error:Not sure how you feel about this solution, but I traced the problem down to
/src/Asset.js:70
.this.contents
is equal to an empty string, therefore this check evaluates falsy and the contents are not parsed. The end result is thatthis.ast
is not set and remainsnull
.Because of this,
/src/SASSAsset.js:51
blows up:EDIT:
Pushed up the same fix for LESS files.