Skip to content

Fix Sass ESM deprecation handling in build#951

Merged
PeterDaveHello merged 1 commit intoChatGPTBox-dev:masterfrom
PeterDaveHello:fix/build-sass-esm-deprecation
Mar 8, 2026
Merged

Fix Sass ESM deprecation handling in build#951
PeterDaveHello merged 1 commit intoChatGPTBox-dev:masterfrom
PeterDaveHello:fix/build-sass-esm-deprecation

Conversation

@PeterDaveHello
Copy link
Member

@PeterDaveHello PeterDaveHello commented Mar 8, 2026

Resolve the Sass implementation from the ESM module namespace before falling back to the default export.

This avoids triggering the deprecated default-export access in sass and sass-embedded while preserving the existing fallback order and behavior for supported Sass packages.

Summary by CodeRabbit

  • Bug Fixes

    • Improved handling of Sass module initialization with normalized module resolution.
    • Added fallback error messaging when Sass implementation fails to load.
  • Chores

    • Enhanced build configuration for better module compatibility.

Resolve the Sass implementation from the ESM module namespace
before falling back to the default export.

This avoids triggering the deprecated default-export access in
sass and sass-embedded while preserving the existing fallback
order and build behavior.
@PeterDaveHello PeterDaveHello requested a review from Copilot March 8, 2026 15:36
@qodo-code-review
Copy link
Contributor

Review Summary by Qodo

Resolve Sass ESM module namespace before default export

🐞 Bug fix

Grey Divider

Walkthroughs

Description
• Adds resolveSassImplementation() helper function to properly resolve Sass from ESM module
  namespace
• Checks for info property on module to identify valid Sass implementation
• Prioritizes direct module export over deprecated default export
• Avoids triggering deprecation warnings in sass and sass-embedded packages
Diagram
flowchart LR
  A["Import sass-embedded/sass"] --> B["resolveSassImplementation()"]
  B --> C{"Check mod.info?"}
  C -->|Yes| D["Return mod"]
  C -->|No| E{"Check mod.default.info?"}
  E -->|Yes| F["Return mod.default"]
  E -->|No| G["Return mod"]
  D --> H["Valid Sass Implementation"]
  F --> H
  G --> H
Loading

Grey Divider

File Changes

1. build.mjs 🐞 Bug fix +8/-2

Add Sass ESM module resolution helper

• Introduces resolveSassImplementation() helper function that checks for info property to
 identify valid Sass implementations
• Prioritizes direct module export over deprecated default export by checking mod.info before
 mod.default.info
• Updates both sass-embedded and sass import handlers to use the new resolution function
• Maintains existing fallback behavior while avoiding deprecation warnings

build.mjs


Grey Divider

Qodo Logo

@qodo-code-review
Copy link
Contributor

qodo-code-review bot commented Mar 8, 2026

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 8, 2026

📝 Walkthrough

Walkthrough

The build configuration now includes a dedicated function to normalize Sass module objects during import resolution. This ensures consistent handling of both default and direct module exports, with improved fallback error reporting when Sass implementations fail to load.

Changes

Cohort / File(s) Summary
Sass Module Resolution
build.mjs
Adds resolveSassImplementation() helper to normalize Sass module objects by checking for an info string property. Applies normalization to primary and fallback Sass imports in getSassImplementation(). Includes fallback error when both Sass implementations fail to load.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A rabbit hops through Sass with glee,
Normalizing modules—what a spree!
No more confusion from imports that waver,
Error handling now brings proper flavor! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Fix Sass ESM deprecation handling in build' directly and specifically describes the main change - addressing Sass ESM deprecation issues in the build process.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

@gemini-code-assist
Copy link

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refines the mechanism for loading Sass implementations within the build process. It addresses and prevents deprecation warnings associated with accessing Sass via its default export in ESM environments by introducing a dedicated resolution function. This change ensures robust and future-proof module loading while preserving the established fallback order for different Sass packages.

Highlights

  • Sass ESM Deprecation Handling: Introduced a new helper function, resolveSassImplementation, to correctly resolve Sass implementations from ESM module namespaces, which prevents triggering deprecated default-export access warnings.
  • Improved Sass Module Resolution Logic: Updated the getSassImplementation function to utilize the new resolveSassImplementation helper, ensuring that the Sass module is properly identified whether it's the module itself or its default export, while maintaining the existing fallback order for sass-embedded and sass.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • build.mjs
    • Added a new utility function resolveSassImplementation to handle Sass module resolution.
    • Updated getSassImplementation to utilize the new resolution logic for sass-embedded and sass imports.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request correctly addresses a deprecation warning from Sass by prioritizing the ESM module namespace over the default export when resolving the Sass implementation. The change is well-contained within a new helper function. I've added one comment with a medium severity suggesting a small adjustment to the fallback logic to ensure it more closely matches the original behavior in edge cases, as stated in the PR description.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes Sass ESM deprecation warnings in the build process by introducing a resolveSassImplementation helper that checks the module namespace for the Sass API (via the info property) before falling back to the default export. This avoids triggering deprecated default-export access in sass and sass-embedded ESM packages.

Changes:

  • Added resolveSassImplementation() function that detects the Sass implementation by checking for the info string property on the module namespace first, then on mod.default
  • Replaced mod.default || mod with resolveSassImplementation(mod) in both the sass-embedded and sass import paths

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@PeterDaveHello PeterDaveHello merged commit fb6a360 into ChatGPTBox-dev:master Mar 8, 2026
7 checks passed
@PeterDaveHello PeterDaveHello deleted the fix/build-sass-esm-deprecation branch March 8, 2026 16:09
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.

2 participants