Skip to content
This repository has been archived by the owner on Mar 22, 2023. It is now read-only.

Second compile doesn't clean the error and warning properties #20

Closed
monvillalon opened this issue Jun 15, 2017 · 2 comments
Closed

Second compile doesn't clean the error and warning properties #20

monvillalon opened this issue Jun 15, 2017 · 2 comments

Comments

@monvillalon
Copy link
Contributor

monvillalon commented Jun 15, 2017

The warning and error properties of the stats result
of the previous compilation and merged into the
new stats instead of reflecting the new values

I think it was introduced here: 91fb22f

I solved it in my local copy by changing

        var stats = compilation.getStats().toJson(options)
        cache = _.merge(cache, stats)  // <<< MERGE ARRAYS
        result = JSON.stringify(cache)
        return result

to

        var stats = compilation.getStats().toJson(options)
        cache = _.assign(cache, stats) // <<< DON'T MERGE ARRAYS
        result = JSON.stringify(cache)
        return result

but don't know if this breaks something else. As far as I can deduce, every compilation event
emits the full value of every property even if some are missing, but I might be wrong and
errors and warnings should be handled as a special case

        var stats = compilation.getStats().toJson(options)
        cache = _.merge(cache, stats) 
        // === DON'T MERGE ERRORS AND WARNINGS
        if (stats.errors) cache.errors = stats.errors
        if (stats.warnings) cache.warnings = stats.warnings
        // === DON'T MERGE ERRORS AND WARNINGS
        result = JSON.stringify(cache)
        return result

I'll write a merge request but I first would like to have your input as to what
approach to take.

Thanks

@monvillalon
Copy link
Contributor Author

monvillalon commented Jun 15, 2017

Found the related issue for the commit
#13

Because of this, I think option 3, treating the errors and warnings as a special case
is the smarter choice. But further research has to be done if this
happens with the other properties.

@unindented
Copy link
Owner

Fixed by #21

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

No branches or pull requests

2 participants