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.
@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.
@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.
leads to my system becoming unresponsive
Please provide steps to reproduce
There was a problem hiding this comment.
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:
There was a problem hiding this comment.
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.
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.
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.
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.
Updating mini-css-extract-plugin from 1.6.0 to 2.9.0 resolved the issue.
…r API
This PR contains a:
Motivation / Use-Case
fixes #774
Breaking Changes
No
Additional Info
No