Skip to content

fix: options passed with installModule are overwritten#2882

Merged
kazupon merged 4 commits into
nuxt-modules:mainfrom
BobbieGoede:fix/install-module-locales-merging
Mar 27, 2024
Merged

fix: options passed with installModule are overwritten#2882
kazupon merged 4 commits into
nuxt-modules:mainfrom
BobbieGoede:fix/install-module-locales-merging

Conversation

@BobbieGoede
Copy link
Copy Markdown
Member

🔗 Linked issue

❓ Type of change

  • 📖 Documentation (updates to the documentation, readme or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

Resolves #2874
Resolves #2809

As options passed to the module setup already contain the merged layer options, the only way we can retrieve the locales and vueI18n options are by looking for absolute paths and whether they do not match layer configurations.

And since we can't know which module installs our module, and we also don't know which layer has the installer module configured, we don't know the priority at which we should merge these options. So far it seems that the approach in other modules is to treat installModule as having a higher priority than the project layer.

I added support for this since it seems there is demand for this functionality, but I honestly think this will cause issues if a lot of modules end up doing this, extending projects with layers is a much more predictable and safe approach and as such I have recommended this in the documentation as well.

📝 Checklist

  • I have linked an issue or discussion.
  • I have added tests (if possible).
  • I have updated the documentation accordingly.

@BobbieGoede BobbieGoede requested a review from kazupon March 26, 2024 18:36
@BobbieGoede BobbieGoede self-assigned this Mar 26, 2024
Copy link
Copy Markdown
Collaborator

@kazupon kazupon left a comment

Choose a reason for hiding this comment

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

Great work!
LGTM!

@kazupon kazupon merged commit 860dca9 into nuxt-modules:main Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants