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: options passed with installModule are overwritten #2882

Merged

Conversation

BobbieGoede
Copy link
Collaborator

πŸ”— 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 self-assigned this Mar 26, 2024
Copy link
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
7 checks passed
DarthGigi pushed a commit to DarthGigi/i18n that referenced this pull request Apr 16, 2024
…s#2882)

* fix: locales provided via `installModule` being ignored

* fix: use `locales` and `vueI18n` passed by `installModule`

* test: add `installModule` options tests

* docs: add `installModule` documentation
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