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

[Meteor 3] Stop loading packages in pararel #13074

Draft
wants to merge 1 commit into
base: release-3.0
Choose a base branch
from

Conversation

denihs
Copy link
Contributor

@denihs denihs commented Mar 27, 2024

For more context: https://forums.meteor.com/t/order-of-loading-packages/61112.

We are getting error reports about the order in the packages that are being imported.

There isn't a bug. The code works by design, but the new brings some issues.

Solution

As @zodern suggested, I'm removing all deps code from code-runtime and linker.

But It's not working correctly. I'm getting this error:

Screenshot from 2024-03-27 11-17-07

Inside ddp-server, Webapp object is not being found, even though the webapp package loads first.

I'll contact @zodern, and hopefully, they can set us on the right path.

Reproduction: https://github.com/plbkbx/testLoadingPackages (run this app with your local Meteor at this branch).

Copy link

netlify bot commented Mar 27, 2024

Deploy Preview for v3-meteor-api-docs canceled.

Name Link
🔨 Latest commit 9106a74
🔍 Latest deploy log https://app.netlify.com/sites/v3-meteor-api-docs/deploys/66043b669026780008428305

@denihs denihs requested a review from zodern March 27, 2024 15:31
@denihs denihs added this to the Release 3.0 milestone Mar 27, 2024
@zodern
Copy link
Member

zodern commented Apr 2, 2024

Inside ddp-server, Webapp object is not being found, even though the webapp package loads first.

WebApp uses top level await. This error indicates that the ddp-server starts loading before webapp finished loading.

How core runtime works is:

  1. On the server, all js images are evaluated synchronously. Each image calls core-runtime.queue to schedule when the package/app code should run.
  2. After all images are queued, the server/meteor tool calls waitUntilAllLoaded to know when all packages and the app code has finished loading.

The client is similar, except in development queueing the packages isn't synchronous since each package loads in a separate script.

The core runtime still needs to ensure each package loads at the correct time. Instead of only waiting for its deps, it needs to wait for all of the previously queued packages (it's now a simple queue that runs one at a time).

});
});
})
// TODO it looks like this function doesn't need to exist anymore
Copy link
Member

Choose a reason for hiding this comment

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

This function is still important for Meteor to know when packages and the app finished loading, including any async modules they have.

`Package["core-runtime"].queue("${options.name}", [`,
orderedDeps.join(', '),
'], function () {'
`Package["core-runtime"].queue("${options.name}",`,
Copy link
Member

Choose a reason for hiding this comment

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

You should be able to completely remove the deps option from fullLink, and replace it with a hasRuntime option instead. This would also help with the linker cache so it isn't invalidated as often.

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

Successfully merging this pull request may close these issues.

None yet

2 participants