-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
NoWorkResult
and LazyResult
have very subtle differences and these can be accidentally encountered
#1869
Comments
We can add extra check, send PR. |
I don't really want to change anything unless I fully understand this.
I think this is the more important question :) |
It should not. We are using |
does this PR makes it better ? |
Thanks @ahmdammarr, This does not fix the underlying issue that |
How we can repeat this issue. I also thought that this issue is only about |
I've added failing tests in a PR : #1909 |
I think that I don't currently have the time and capacity to context switch to this issue :/ My current workaround is to always pass a plugin, one that doesn't do anything : const noopPlugin = () => {
return {
postcssPlugin: 'noop-plugin',
Once() {
// do nothing
},
};
};
noopPlugin.postcss = true;
export default noopPlugin; This forces |
If you have time, can you check why there is a difference between them? |
@romainmenke as per my understanding the issue here was forcing a about this👇🏼
If we expect the same result, why would we use two classes if (
this.plugins.length === 0 &&
typeof opts.parser === 'undefined' &&
typeof opts.stringifier === 'undefined' &&
typeof opts.syntax === 'undefined'
) |
Many users are using PostCSS in a wrong way calling it even if they don't need it (they don't use any plugins, etc). We have |
I did a quick research on how both classes behave, and so far I found that both have lots of common details, so what I'm proposing is to have one class and handle edge cases (eg: not parsing CSS if not needed) need to spend more time on discovery if what i proposed is valid! |
Of course we can refactor code, but I prefer to fix them issue first. |
I've opened an issue for more general discussion about |
I've added a pull request to address the differences between |
postcss/lib/processor.js
Lines 44 to 55 in a0a82d3
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 aLazyResult
.Setting
null
instead ofundefined
is a common mistake, especially when not using TypeScript.Is it intentional that
NoWorkResult
andLazyResult
have different CSS outputs?The text was updated successfully, but these errors were encountered: