Skip to content

Fix SSR compatibility and module bundling issues of Nuxt#483

Merged
DonOmalVindula merged 3 commits intoasgardeo:mainfrom
kavindadimuthu:fix-nuxt-release-2
Apr 29, 2026
Merged

Fix SSR compatibility and module bundling issues of Nuxt#483
DonOmalVindula merged 3 commits intoasgardeo:mainfrom
kavindadimuthu:fix-nuxt-release-2

Conversation

@kavindadimuthu
Copy link
Copy Markdown
Contributor

@kavindadimuthu kavindadimuthu commented Apr 28, 2026

Purpose

Related Issues

  • N/A

Related PRs

  • N/A

Checklist

  • Followed the CONTRIBUTING guidelines.
  • Manual test round performed and verified.
  • Documentation provided. (Add links if there are any)
  • Unit tests provided. (Add links if there are any)

Security checks

Summary by CodeRabbit

  • Bug Fixes

    • Resolved Server-Side Rendering compatibility issues in browser package through improved module resolution
    • Fixed Rollup bundler issues in Nuxt package by consolidating type definitions
    • Improved TypeScript configuration support for Nuxt modules
  • Chores

    • Updated package publishing to include all necessary TypeScript definition files

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 28, 2026

Warning

Rate limit exceeded

@kavindadimuthu has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 49 minutes and 38 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d0616680-7032-4c44-bc6e-2601e3257239

📥 Commits

Reviewing files that changed from the base of the PR and between 519fa74 and e0256ee.

📒 Files selected for processing (1)
  • packages/nuxt/src/runtime/plugins/asgardeo.ts
📝 Walkthrough

Walkthrough

Refactors Node.js ESM imports for SSR compatibility in the browser package and consolidates TypeScript type augmentations from a separate generated file into the source module for the Nuxt package, ensuring proper typing inclusion in the published distribution.

Changes

Cohort / File(s) Summary
Changeset Metadata
.changeset/lemon-trams-mix.md
New patch release entry documenting SSR compatibility fixes and bundling improvements for both packages.
Buffer Polyfill Configuration
packages/browser/esbuild.config.mjs
Updated esbuild polyfill wiring to use explicit buffer/index.js entry point instead of directory imports (buffer/) for SSR compatibility.
Nuxt Type Augmentation Consolidation
packages/nuxt/src/module.ts
Consolidated type augmentations for @nuxt/schema (NuxtConfig/NuxtOptions) and h3 (H3EventContext) from separate generated file into source module declarations.
Nuxt Plugin Adjustments
packages/nuxt/src/runtime/plugins/asgardeo.ts, packages/nuxt/src/runtime/server/plugins/asgardeo-ssr.ts
Removed type augmentation imports and added explicit type casting for type-compatibility in server-side fallback logic.
Nuxt Publishing Configuration
packages/nuxt/.npmignore
Removed ignore rule for dist/runtime/types/augments.d.ts to include type augmentation files in the published package.
Nuxt Type File Removal
packages/nuxt/src/runtime/types/augments.d.ts
Deleted generated augmentation file; declarations moved to source module.ts.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • brionmario
  • DonOmalVindula

Poem

🐰 From scattered types to unified source,
We bundle Buffer for the SSR course,
Augmentations consolidated with care,
No more files lost without a spare! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description contains only the template structure with empty sections. The Purpose section is not filled in with any details about the SSR/bundling fixes, and no related issues, tests, or documentation are documented. Complete the Purpose section with details about the SSR compatibility and bundling issues being fixed, and fill in any relevant Related Issues/PRs, tests, and documentation links.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The PR title 'Fix SSR compatibility and module bundling issues of Nuxt' accurately describes the main changes: Buffer import fixes for SSR, type augmentation consolidation, and Rollup bundling resolution.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/browser/esbuild.config.mjs (1)

49-71: ⚠️ Potential issue | 🟠 Major

Split banner and footer by output format—CJS build will fail with import statement in banner.

Lines 49-71 define a shared commonOptions object with a banner (line 51) containing ESM syntax (import { Buffer } from 'buffer/index.js') and a footer (line 69) containing CJS syntax (require('buffer/index.js')). Both builds at lines 92–104 reuse this object regardless of format.

When format: 'cjs' is used, the ESM import statement in the banner will cause a runtime SyntaxError because import declarations cannot coexist with prior CommonJS content in the same output.

Move banner and footer out of commonOptions and define them per-build with format-appropriate syntax:

Proposed fix
 const commonOptions = {
-  banner: {
-    js: `
-      import { Buffer } from 'buffer/index.js';
-      if (typeof window !== 'undefined' && !window.Buffer) {
-        window.Buffer = Buffer;
-      }
-    `,
-  },
   bundle: true,
@@
-  footer: {
-    js: `
-      if (typeof window !== 'undefined' && !window.Buffer) {
-        window.Buffer = require('buffer/index.js').Buffer;
-      }
-    `,
-  },
   platform: 'browser',
@@
 await esbuild.build({
   ...commonOptions,
+  banner: {
+    js: `
+      import { Buffer } from 'buffer/index.js';
+      if (typeof window !== 'undefined' && !window.Buffer) {
+        window.Buffer = Buffer;
+      }
+    `,
+  },
   format: 'esm',
   outfile: 'dist/index.js',
   sourcemap: true,
 });
 
 await esbuild.build({
   ...commonOptions,
+  banner: {
+    js: `
+      const { Buffer } = require('buffer/index.js');
+      if (typeof window !== 'undefined' && !window.Buffer) {
+        window.Buffer = Buffer;
+      }
+    `,
+  },
   format: 'cjs',
   outfile: 'dist/cjs/index.js',
   sourcemap: true,
 });
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/browser/esbuild.config.mjs` around lines 49 - 71, The shared
commonOptions currently embeds both an ESM-style banner (import { Buffer } ...)
and a CJS-style footer (require(...)) which breaks the CJS build; move banner
and footer out of commonOptions and set them per-build based on the build format
(e.g., when creating the CJS build use a CJS-safe banner/footer using require
and for the ESM build use the import-based banner/footer), updating the code
that constructs each build (the logic around where commonOptions is spread into
the per-build config) so each config supplies its own banner/footer instead of
inheriting both from commonOptions.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@packages/browser/esbuild.config.mjs`:
- Around line 49-71: The shared commonOptions currently embeds both an ESM-style
banner (import { Buffer } ...) and a CJS-style footer (require(...)) which
breaks the CJS build; move banner and footer out of commonOptions and set them
per-build based on the build format (e.g., when creating the CJS build use a
CJS-safe banner/footer using require and for the ESM build use the import-based
banner/footer), updating the code that constructs each build (the logic around
where commonOptions is spread into the per-build config) so each config supplies
its own banner/footer instead of inheriting both from commonOptions.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 89952668-81e2-4d53-82b7-d23936471bf1

📥 Commits

Reviewing files that changed from the base of the PR and between 23df3c7 and 519fa74.

📒 Files selected for processing (7)
  • .changeset/lemon-trams-mix.md
  • packages/browser/esbuild.config.mjs
  • packages/nuxt/.npmignore
  • packages/nuxt/src/module.ts
  • packages/nuxt/src/runtime/plugins/asgardeo.ts
  • packages/nuxt/src/runtime/server/plugins/asgardeo-ssr.ts
  • packages/nuxt/src/runtime/types/augments.d.ts
💤 Files with no reviewable changes (3)
  • packages/nuxt/.npmignore
  • packages/nuxt/src/runtime/server/plugins/asgardeo-ssr.ts
  • packages/nuxt/src/runtime/types/augments.d.ts

@asgardeo-github-bot
Copy link
Copy Markdown

🦋 Changeset detected

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

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

@DonOmalVindula DonOmalVindula merged commit 64b1033 into asgardeo:main Apr 29, 2026
7 of 9 checks passed
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