Skip to content

Conversation

@MenKNas
Copy link
Contributor

@MenKNas MenKNas commented Jan 20, 2026

Description / Motivation

Issue

Next.js 16 upgrade broke Sass compilation in nextjs-sxa template:

  • sass-alias package uses legacy Sass API incompatible with Next.js 16
  • Node.js built-in modules being bundled for client causing build errors

Fix

  • Replaced sass-alias with custom importer implementing Next.js 16 Sass API
  • Added webpack config to exclude Node.js built-ins from client bundle
  • Removed sass-alias dependency

Testing Details

  • Unit Test Added
  • Manual Test/Other (Please elaborate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

@MenKNas MenKNas self-assigned this Jan 20, 2026
// Exclude Node.js built-in modules from client bundle
// This is needed for plugins that use Node.js modules (e.g., sass plugin with fs)
if (!isServer) {
config.resolve.fallback = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is blanket approach unavoidable here? Can this be limited only to modules used by sass plugin?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, that's actually a good catch. Made the webpack config scoped to the sass plugin.

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