-
Notifications
You must be signed in to change notification settings - Fork 384
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
inconsistent message from extract and macro with multiple consecutive newlines / trailing spaces #1799
Comments
we have to admit that normalize whitespace for jsx is unfortunate but has no choice, but I would suggest we skip normalization for macroJs ones, and just take whatever in the macro methods... which aligns with extract and matches user expectation as well |
or at least match the behavior between extract and macro :) |
The extract uses macro under the hood so the result should be the same. The difference might be if you use SWC plugin for macro, this way extract would use JS counterpart. Could you provide an example of code which works inconsistently? |
of course, the minimum example is:
from
while in compiled code, the lingui id it used to look up the message is actually from |
There were differences between swc / babel macro in that matter. I followed your suggestion and completely removed whitespace cleaning from JS macro. I agree, that is useless and counterintuitive. Babel JSX: #1882 |
Describe the bug
just noticed this behavior difference when multiple consecutive newlines involved.
For extract: the newlines are extracted correctly
For macro: the newlines are collapsed due to
js-lingui/packages/macro/src/macroJs.ts
Line 31 in 04b7cef
example from tests:
catalog.test.ts (
\n\n
preserved correctly):macro,
\n\n
collapsed:The text was updated successfully, but these errors were encountered: