Fix Sass ESM deprecation handling in build#951
Conversation
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.
Review Summary by QodoResolve Sass ESM module namespace before default export
WalkthroughsDescription• 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 Diagramflowchart 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
File Changes1. build.mjs
|
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewⓘ The new review experience is currently in Beta. Learn more |
📝 WalkthroughWalkthroughThe 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
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
Summary of ChangesHello, 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
🧠 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
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 theinfostring property on the module namespace first, then onmod.default - Replaced
mod.default || modwithresolveSassImplementation(mod)in both thesass-embeddedandsassimport paths
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
Chores