Skip to content

NoWorkResult and LazyResult have very subtle differences and these can be accidentally encountered #1869

@romainmenke

Description

@romainmenke

postcss/lib/processor.js

Lines 44 to 55 in a0a82d3

process(css, opts = {}) {
if (
this.plugins.length === 0 &&
typeof opts.parser === 'undefined' &&
typeof opts.stringifier === 'undefined' &&
typeof opts.syntax === 'undefined'
) {
return new NoWorkResult(this, css, opts)
} else {
return new LazyResult(this, css, opts)
}
}

For a full repro see : https://github.com/romainmenke/postcss-no-work-result-sourcemaps


By setting parser: null as a processing option you can force a LazyResult.

Setting null instead of undefined is a common mistake, especially when not using TypeScript.


Is it intentional that NoWorkResult and LazyResult have different CSS outputs?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions