Skip to content
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

ModernJS async boundary #3279

Draft
wants to merge 57 commits into
base: master
Choose a base branch
from
Draft

ModernJS async boundary #3279

wants to merge 57 commits into from

Conversation

ScriptedAlchemy
Copy link
Member

No description provided.

@CLAassistant
Copy link

CLAassistant commented Oct 27, 2023

CLA assistant check
All committers have signed the CLA.

@vercel
Copy link

vercel bot commented Oct 27, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
medusa-example-dsl ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 31, 2023 5:38am
medusa-example-home ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 31, 2023 5:38am
medusa-example-nav ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 31, 2023 5:38am
medusa-example-search ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 31, 2023 5:38am
medusa-example-utils ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 31, 2023 5:38am

@github-actions
Copy link

Workflow status is failure ❌
Unfortunately test report wasn't generated, it can be if no workspaces changed. Please check the workflow run below.
Link to GitHub workflow: Github Workflow Link

@github-actions github-actions bot added the workflow-failure Workflow is failed label Oct 27, 2023
@github-actions
Copy link

Workflow status is failure ❌
Unfortunately test report wasn't generated, it can be if no workspaces changed. Please check the workflow run below.
Link to GitHub workflow: Github Workflow Link

@@ -1 +1,12 @@
import('./bootstrap.js');
const promises = []
__webpack_require__.f.remotes('main',promises);
Copy link
Member Author

Choose a reason for hiding this comment

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

hardcoded to main as proof of concept, in reality this would be part of codegen, injected into all entrypoint modules, each passing their own chunkID to the handlers.
effectively making startup asynchronous.

You can also export require(bootstrap) back out, however - the entrypoint will always export a promise. If webpack is handling this entrpoint loading, then async modules will resolve their inner promises. If not, your entrypoint will always export Promise.resolve(module.exports).

In most cases this should not be a problem, as the act of loading an entrypoint is async in ietslf so much should not experience an issue.

The other option involves replacing entrypoint startup code with a promise based export

Copy link
Member Author

Choose a reason for hiding this comment

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

not required if we use the AsyncBoundaryPlugin from modernjs example

Base automatically changed from lerna-v6 to master October 28, 2023 23:20
@github-actions
Copy link

Workflow status is cancelled ❗
Unfortunately test report wasn't generated, it can be if no workspaces changed. Please check the workflow run below.
Link to GitHub workflow: Github Workflow Link

…sync-boundary

# Conflicts:
#	basic-host-remote/app1/modern.config.js
#	basic-host-remote/app2/modern.config.js
@github-actions
Copy link

Workflow status is failure ❌
Checkout tests results here: Cypress e2e Test Report
Link to GitHub workflow: Github Workflow Link
❕Note: Report deployment may take up to 10 minutes.

@github-actions github-actions bot added e2e-failure Test are failed workflow-failure Workflow is failed and removed workflow-cancelled Workflow is cancelled labels Oct 31, 2023
@github-actions
Copy link

Workflow status is failure ❌
Checkout tests results here: Cypress e2e Test Report
Link to GitHub workflow: Github Workflow Link
❕Note: Report deployment may take up to 10 minutes.

@github-actions
Copy link

Workflow status is failure ❌
Checkout tests results here: Cypress e2e Test Report
Link to GitHub workflow: Github Workflow Link
❕Note: Report deployment may take up to 10 minutes.

)}, promiseTrack);`,
`var __webpack_exports__ = Promise.all(promiseTrack).then(function() {`,
source.source(),
'return __webpack_exports__;',
Copy link
Member Author

Choose a reason for hiding this comment

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

entrypoints will always return a promise to webpack, if entrypoint is externally required (like commonjs)

then it will module.exports = new Promise(moduleExports)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
e2e-failure Test are failed workflow-failure Workflow is failed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants