sass-loader
sass-loader copied to clipboard
Use the Sass Compiler API
Modification Proposal
We (the Sass team) have just released a proposal for a Compiler API in Sass that shares resources between different compilations (see also https://github.com/sass/sass/issues/3296). This is particularly useful when using the sass-embedded package, which runs a very fast subprocess to compile Sass: within the lifetime of a single Compiler, the subprocess will remain open, eliminating all the overhead of starting it and shutting it down that currently causes sass-embedded to be slower than it could be.
For now, we're just seeking your feedback on the proposal. Once it lands, we hope you'll integrate it into the plugin for substantially improved performance.
Expected Behavior / Situation
The plugin starts a Compiler when it initializes and uses that compiler to compile all Sass files, so that Sass users using the embedded host experience better performance.
Actual Behavior / Situation
The plugin runs a separate sass.compile() call for each compilation, which has a large amount of overhead when using sass-embedded.
Please paste the results of npx webpack-cli info here, and mention other relevant information
N/A
I agree, internal cache inside sass between compilation will be grea, it will improve perf very well, I don't have good idea how it can be implement, but ready to discuss about any suggestions
@alexander-akait I believe the proposed API has landed in 1.70.0, https://github.com/sass/embedded-host-node/blob/main/CHANGELOG.md#javascript-api-3. Have you started any work on implementing it in sass-loader? If not, I could take a stab at it.
@renspoesse Hello, I didn't start it, so feel free to send a PR
We still not finished https://github.com/webpack-contrib/sass-loader/blob/master/src/utils.js#L614, maybe it is another API right now, need to check