-
Notifications
You must be signed in to change notification settings - Fork 403
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: add environment variable to disable LWC version mismatch loglines #5187
base: master
Are you sure you want to change the base?
Conversation
if (process?.env?.SKIP_LWC_VERSION_MISMATCH_CHECK === 'true') { | ||
warned = true; // skip printing out version mismatch errors when env var is set | ||
return; | ||
} |
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.
We'd need a build-time complement to this environment variable. E.g. when we compile @lwc/engine-dom
, this code path should turn into if (false) {
and be minified away.
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.
@divmain not super familiar with the lwc codebase, can you point me where to make this change?
}).not.toLogErrorDev( | ||
new RegExp( | ||
`LWC WARNING: current engine is v${process.env.LWC_VERSION}, but template was compiled with v123.456.789` | ||
) | ||
); |
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.
}).not.toLogErrorDev( | |
new RegExp( | |
`LWC WARNING: current engine is v${process.env.LWC_VERSION}, but template was compiled with v123.456.789` | |
) | |
); | |
}).not.toLogErrorDev(/v123\.456\.789/); |
Checking that we're not logging such a long message feels easy to get an accidental false positive, if the error text ever changes. We should just check for keywords to be more flexible.
Details
When using LWR local dev for experience sites, every SSR request logs an LWC version mismatch error. This is due to the fact that the engine-server is intentionally reloaded on a per page basis and not cached in memory. Therefore the mechanisms in place to only log a the version mismatch once do not work. The logging noise from this makes observing actual useful errors during SSR more difficult.
My change just introduces a new environment variable that can be set on the LWR side to disable this logging during local development.
Would like to backport this also to spring25
Does this pull request introduce a breaking change?
Does this pull request introduce an observable change?
GUS work item
@W-17740011@