-
-
Notifications
You must be signed in to change notification settings - Fork 431
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
feat: support webpack built-in resolver for modern and modern-compile… #1197
feat: support webpack built-in resolver for modern and modern-compile… #1197
Conversation
e633761
to
4a00573
Compare
if (!sassModernCompilers.has(webpackCompiler)) { | ||
sassModernCompilers.set(webpackCompiler, compiler); | ||
webpackCompiler.hooks.shutdown.tap("sass-loader", () => { | ||
compiler.dispose(); | ||
}); | ||
} | ||
} | ||
|
||
return sassModernCompilers | ||
.get(implementation) | ||
.get(webpackCompiler) |
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.
@alexander-akait the sassModernCompilers
map should map to implementation
, not webpackCompiler
. The current modern-compiler
API in 14.2.0 is broken and leads to my system becoming unresponsive; I think because of this change.
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.
@renspoesse We can't use implementation
as a key, because when you have two compilers with sass-loader
(i.e. multi compiler mode) after closing first we close sass compiler, so the second will failed
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.
leads to my system becoming unresponsive
Please provide steps to reproduce
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.
Please provide steps to reproduce
On a larger project, running webpack in watch mode with modern-compiler
. I don't have detailed steps.
because when you have two compilers with
sass-loader
(i.e. multi compiler mode) after closing first we close sass compiler, so the second will failed
If we do want to use webpackCompiler
as the key, this line also needs updating:
Line 763 in 4edc139
if (!sassModernCompilers.has(implementation)) { |
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.
I see, yeah, I will fix 👍
On a larger project, running webpack in watch mode with modern-compiler. I don't have detailed steps.
Do you find a problem? I want to investigate your problem
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.
I tried with the latest version and the issue still exists. I ran the debugger and stepped through sass-loader, and it looks like webpackCompiler
doesn't maintain a stable reference across invocations for different Sass files; so sassModernCompilers.has(implementation)
still isn't true
and we keep creating a new Dart process for each file.
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.
I tried with the latest version and the issue still exists. I ran the debugger and stepped through sass-loader, and it looks like webpackCompiler doesn't maintain a stable reference across invocations for different Sass files; so sassModernCompilers.has(implementation) still isn't true and we keep creating a new Dart process for each file.
this is not possible because we are creating the only one compiler per configuration
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.
I need a reproducible test repo to undestand your problem, because compiler lives from beginning to end of your watch
/run
/serve
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.
Updating mini-css-extract-plugin from 1.6.0 to 2.9.0 resolved the issue.
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.
@renspoesse Great ⭐
…r API
This PR contains a:
Motivation / Use-Case
fixes #774
Breaking Changes
No
Additional Info
No