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

fix(module-sdk): Shared modules loading #4611

Merged
merged 6 commits into from
Jul 27, 2023

Conversation

adrien2p
Copy link
Member

@adrien2p adrien2p commented Jul 27, 2023

What
Makes the modules container completely isolated no matter the resources module declaration. Register in the isolated container all the dependencies that are required by the modules and always include manager and configModule when the resources are set to shared.

The shared resources should only share the mutualized manager and config module, it makes no sense that the module shares the entire container from the core and should be prevented as it can lead to unintentional behaviors and circumvent the purpose of a module which is to isolate a domain or a feature. Also, if something needs to be shared, it can be passed as a dependency through the configuration. This was also the intention first behind the implementation of the shared concept.

Also, now the product module can be shared if needed in the future (shared knex/driver connection reused by the internal ORM). The module does not export the models since we don't want the internal module models to be shared with the medusa package, nor the migrations.

@changeset-bot
Copy link

changeset-bot bot commented Jul 27, 2023

🦋 Changeset detected

Latest commit: 7b1919b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@medusajs/modules-sdk Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Jul 27, 2023

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

Name Status Preview Comments Updated (UTC)
medusa-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 27, 2023 10:35am

@adrien2p adrien2p marked this pull request as ready for review July 27, 2023 08:19
@adrien2p adrien2p requested a review from a team as a code owner July 27, 2023 08:19
@adrien2p
Copy link
Member Author

I have tested on @pKorsholm pr and it works with all the module being shared, which wasn't working previously

Copy link
Contributor

@carlos-r-l-rodrigues carlos-r-l-rodrigues left a comment

Choose a reason for hiding this comment

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

LGTM

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.

3 participants