Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ export function checkVersionMismatch(
) {
const versionMatcher = func.toString().match(LWC_VERSION_COMMENT_REGEX);
if (!isNull(versionMatcher) && !warned) {
if (process?.env?.SKIP_LWC_VERSION_MISMATCH_CHECK === 'true') {
warned = true; // skip printing out version mismatch errors when env var is set
return;
}

const version = versionMatcher[1];
if (version !== LWC_VERSION) {
warned = true; // only warn once to avoid flooding the console
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,23 @@ describe('compiler version mismatch', () => {
});

afterEach(() => {
process.env.SKIP_LWC_VERSION_MISMATCH_CHECK = 'false';
detachReportingControlDispatcher();
});

it('skip warning during local dev', () => {
process.env.SKIP_LWC_VERSION_MISMATCH_CHECK = 'true';
function tmpl() {
return [];
/*LWC compiler v123.456.789*/
}

expect(() => {
registerTemplate(tmpl);
}).not.toLogErrorDev(new RegExp(`LWC WARNING:`));
expect(dispatcher).not.toHaveBeenCalled();
});

it('template', () => {
function tmpl() {
return [];
Expand Down
3 changes: 3 additions & 0 deletions scripts/rollup/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ function sharedPlugins() {
// This is only used inside @lwc/engine-dom and @lwc/engine-server
// Elsewhere, it _not_ be replaced, so that it can be replaced later (e.g. in @lwc/engine-core)
'process.env.IS_BROWSER': packageName === '@lwc/engine-dom' ? 'true' : 'false',
...(packageName === '@lwc/engine-dom'
? { 'process.env.SKIP_LWC_VERSION_MISMATCH_CHECK': 'false' }
: {}),
};

return [
Expand Down
Loading