-
-
Notifications
You must be signed in to change notification settings - Fork 377
docs: Add SSR configuration guide for vue-i18n plugin #2262
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
Conversation
WalkthroughAdds a new SSR subsection to the "Pre translations with extensions" documentation, showing how to enable SSR support in @intlify/unplugin-vue-i18n via Vite config by setting VueI18nPlugin({ ssr: true }). No code or API changes. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related issues
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests
Tip 👮 Agentic pre-merge checks are now available in preview!Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.
Please see the documentation for more information. Example: reviews:
pre_merge_checks:
custom_checks:
- name: "Undocumented Breaking Changes"
mode: "warning"
instructions: |
Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal). Please share your feedback with us on this Discord post. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (4)
docs/guide/advanced/optimization.md (4)
181-186
: Consider relocating this SSR subsection (or cross-linking) for discoverability.This new SSR config guidance sits under “Pre translations with extensions,” but it applies to any SSR app using the unplugin. Suggest moving it under the earlier “unplugin-vue-i18n” section or adding a short cross-link there to avoid readers missing it.
188-200
: Add a version note: SSR option requires vue-i18n ≥ 9.4.Per the plugin docs,
ssr
works with vue-i18n v9.4+; adding a short tip avoids confusion for users on older versions.Apply this diff to append a note after the code block:
export default defineConfig({ plugins: [ VueI18nPlugin({ ssr: true, // Enable SSR support }), ], })+:::tip NOTE
+ssr
requiresvue-i18n
v9.4 or later.
+:::([npmjs.com](https://www.npmjs.com/package/%40intlify/unplugin-vue-i18n/v/1.6.0)) --- `188-200`: **Include a webpack example for parity.** Many readers use webpack—mirroring the vite snippet improves coverage. Apply this diff to add a webpack snippet right after the vite block: ```diff })
+```js
+// webpack.config.js
+const VueI18nPlugin = require('@intlify/unplugin-vue-i18n/webpack')
+
+module.exports = {
- plugins: [
- VueI18nPlugin({
ssr: true, // Enable SSR support
- })
- ]
+}
+```([npmjs.com](https://www.npmjs.com/package/%40intlify/unplugin-vue-i18n/v/1.6.0)) --- `186-196`: **Optional: mention v-t directive optimization requirement for SSR use-cases.** When projects rely on the `v-t` directive during SSR, the plugin’s `optimizeTranslationDirective` should be enabled; adding a short pointer helps prevent SSR-only surprises. You could append a sentence: “If you use the v-t directive with SSR, also set optimizeTranslationDirective: true.” ([snyk.io](https://snyk.io/advisor/npm-package/%40intlify/unplugin-vue-i18n?utm_source=openai)) </blockquote></details> </blockquote></details> <details> <summary>📜 Review details</summary> **Configuration used**: CodeRabbit UI **Review profile**: CHILL **Plan**: Pro <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 341ecee9a883d36dc43818e833a6048c65ab176b and 543c34a26489bf4f621761e9f73912afed2f47bd. </details> <details> <summary>📒 Files selected for processing (1)</summary> * `docs/guide/advanced/optimization.md` (1 hunks) </details> <details> <summary>🔇 Additional comments (1)</summary><blockquote> <details> <summary>docs/guide/advanced/optimization.md (1)</summary><blockquote> `182-200`: **Example looks correct for enabling SSR in the plugin.** The `ssr: true` option is valid for `@intlify/unplugin-vue-i18n` and enables bundling the SSR build of vue-i18n. ✔️ ([npmjs.com](https://www.npmjs.com/package/%40intlify/unplugin-vue-i18n/v/1.6.0)) </blockquote></details> </blockquote></details> </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
LGTM!
#2257
Summary by CodeRabbit