-
-
Notifications
You must be signed in to change notification settings - Fork 7
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
Resolved an error that occurs when using with sass 1.60.x #205
Conversation
``` Test Suites: 5 failed, 14 passed, 19 total Tests: 9 failed, 1 todo, 100 passed, 110 total Snapshots: 53 passed, 53 total Time: 6.758 s, estimated 7 s ```
@@ -22,7 +22,8 @@ function promisifySassRender(sass: typeof import('sass')) { | |||
export const createScssTransformer: () => Transformer = () => { | |||
let sass: typeof import('sass'); | |||
return async (source, options) => { | |||
sass ??= (await import('sass').catch(handleImportError('sass'))).default; | |||
const importedSass = await import('sass').catch(handleImportError('sass')) | |||
sass ??= importedSass.default ?? importedSass; |
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.
note: I implemented this pattern because I confirmed that simply removing .default would cause it to stop working with versions prior to 1.60.x.
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.
LGTM! Thank you for contributing. 👍
Thank you for notifying me. :) I've just updated to version 2.1.2 in my workspace and verified that everything is functioning as it should 🎉. I appreciate your support. 🙏 |
First of all, thank you for creating this wonderful CLI. I use it all the time and it has been a great help.
Currently, when used with the latest version of sass, which is 1.63.3, an error occurs.
repro: on this branch
This is likely due to breaking changes introduced by sass.
ref. sass/dart-sass#2011
In this PR, we will avoid this by using the default when importing, if it exists, and not using the default if it doesn't.