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

feat(ssr): support circular dependencies in ssr #2489

Closed
wants to merge 2 commits into from

Conversation

antimatter15
Copy link

This PR addresses #2258.

Currently, whenever a circular dependency is encountered, ssrLoadModule returns an empty object, causing any code that requires circular dependencies to fail.

The algorithm is inspired by es-module-loader. This PR changes instantiateModule to store the SSR Module exports object in the ModuleNode before its dependencies are loaded and before the code is executed. If ssrLoadModule detects that it is doing a circular import, then it returns that "live" ssrModule object (which hasn't yet been populated yet). Once all the dependencies are loaded, the ssrModule object is frozen.

@antimatter15
Copy link
Author

This approach doesn't work, will reopen PR once a working approach is found.

@brillout
Copy link
Contributor

Any news on this?

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