Skip to content

Conversation

wjhsf
Copy link
Contributor

@wjhsf wjhsf commented Sep 4, 2025

Details

  1. ENABLE_SYNTHETIC_IN_HYDRATION_MODE does the same thing as DISABLE_SYNTHETIC, just reversed.
  2. Cleaned up the serve-hydration plugin a bit. The goal is to get everything as close to pure ESM as possible, rather than confusing layers of wrapping and bundling and indirection.

Does this pull request introduce a breaking change?

  • 😮‍💨 No, it does not introduce a breaking change.
  • 💔 Yes, it does introduce a breaking change.

Does this pull request introduce an observable change?

  • 🤞 No, it does not introduce an observable change.
  • 🔬 Yes, it does include an observable change.

GUS work item

There's no setup/teardown needed, it's a single test, and WTR provides per-file encapsulation
working toward just importing and executing things, but not quite there yet
two env vars for the same goal is unnecessary
I think the last one was a concurrency related timeout,
which was previously addressed.
@wjhsf wjhsf requested a review from a team as a code owner September 4, 2025 18:55
config = config || {};
${moduleCode};
moduleOutput = LWC.renderComponent(
`(() => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The returned value when running a script is the result of the last statement of the script. Using an IIFE1 allows us to avoid mucking around with the context object.

1 Technically we can just do LWC.renderComponent() without wrapping it, but most people are probably unfamiliar with vm.Script. I think that using a more familiar pattern makes it more clear what's going on.

});
const {
default: { expectedSSRConsoleCalls, requiredFeatureFlags },
} = await import(path.join(ROOT_DIR, filePath));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need all the extra bundling when import(configFile) works just fine.

@@ -100,7 +99,7 @@ function throwOnUnexpectedConsoleCalls(runnable, expectedConsoleCalls = {}) {
};
}
try {
runnable();
return runnable();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔔 TIL: even if we return in try catch, finally still gets executed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants