lwc icon indicating copy to clipboard operation
lwc copied to clipboard

[SSR] Make dynamic `import()`s no-ops

Open nolanlawson opened this issue 1 year ago • 5 comments

In the SSR compiler, dynamic import()s should (probably) be no-ops because we run in sync mode so you wouldn't be able to do anything with the constructor you import anyway.

We also need to strip these import()s anyway because core will complain if it sees them after compilation.

nolanlawson avatar Nov 15 '24 19:11 nolanlawson

This issue has been linked to a new work item: W-17248485

git2gus[bot] avatar Nov 15 '24 19:11 git2gus[bot]

If we're moving forward with sync mode, do we need to block more flavors of async operations?

wjhsf avatar Nov 18 '24 18:11 wjhsf

No, they just won't work. We already have a test for Promise.resolve().

nolanlawson avatar Nov 18 '24 18:11 nolanlawson

This seems fixed by:

  • https://github.com/salesforce/lwc/pull/4887

Or does this also need to be fixed in @lwc/engine-server?

cardoso avatar Nov 29 '24 17:11 cardoso

Long-term, yes. And for engine-dom too. But for now we still have many internal customers who are relying on this API.

nolanlawson avatar Dec 02 '24 16:12 nolanlawson