@@ -12,10 +12,8 @@ import { fileURLToPath, pathToFileURL } from 'node:url';
12
12
import type { FileImporter } from 'sass' ;
13
13
import type { Configuration , LoaderContext , RuleSetUseItem } from 'webpack' ;
14
14
import { WebpackConfigOptions } from '../../../utils/build-options' ;
15
- import { useLegacySass } from '../../../utils/environment-options' ;
16
15
import { findTailwindConfigurationFile } from '../../../utils/tailwind' ;
17
16
import { SassWorkerImplementation } from '../../sass/sass-service' ;
18
- import { SassLegacyWorkerImplementation } from '../../sass/sass-service-legacy' ;
19
17
import {
20
18
AnyComponentStyleBudgetChecker ,
21
19
PostcssCliResources ,
@@ -63,9 +61,7 @@ export async function getStylesConfig(wco: WebpackConfigOptions): Promise<Config
63
61
}
64
62
}
65
63
66
- const sassImplementation = useLegacySass
67
- ? new SassLegacyWorkerImplementation ( )
68
- : new SassWorkerImplementation ( ) ;
64
+ const sassImplementation = new SassWorkerImplementation ( ) ;
69
65
70
66
extraPlugins . push ( {
71
67
apply ( compiler ) {
@@ -314,63 +310,33 @@ export async function getStylesConfig(wco: WebpackConfigOptions): Promise<Config
314
310
315
311
function getSassLoaderOptions (
316
312
root : string ,
317
- implementation : SassWorkerImplementation | SassLegacyWorkerImplementation ,
313
+ implementation : SassWorkerImplementation ,
318
314
includePaths : string [ ] ,
319
315
indentedSyntax : boolean ,
320
316
verbose : boolean ,
321
317
preserveSymlinks : boolean ,
322
318
) : Record < string , unknown > {
323
- return implementation instanceof SassWorkerImplementation
324
- ? {
325
- sourceMap : true ,
326
- api : 'modern' ,
327
- implementation,
328
- // Webpack importer is only implemented in the legacy API and we have our own custom Webpack importer.
329
- // See: https://github.com/webpack-contrib/sass-loader/blob/997f3eb41d86dd00d5fa49c395a1aeb41573108c/src/utils.js#L642-L651
330
- webpackImporter : false ,
331
- sassOptions : ( loaderContext : LoaderContext < { } > ) => ( {
332
- importers : [ getSassResolutionImporter ( loaderContext , root , preserveSymlinks ) ] ,
333
- loadPaths : includePaths ,
334
- // Use expanded as otherwise sass will remove comments that are needed for autoprefixer
335
- // Ex: /* autoprefixer grid: autoplace */
336
- // See: https://github.com/webpack-contrib/sass-loader/blob/45ad0be17264ceada5f0b4fb87e9357abe85c4ff/src/getSassOptions.js#L68-L70
337
- style : 'expanded' ,
338
- // Silences compiler warnings from 3rd party stylesheets
339
- quietDeps : ! verbose ,
340
- verbose,
341
- syntax : indentedSyntax ? 'indented' : 'scss' ,
342
- sourceMapIncludeSources : true ,
343
- } ) ,
344
- }
345
- : {
346
- sourceMap : true ,
347
- api : 'legacy' ,
348
- implementation,
349
- sassOptions : {
350
- importer : ( url : string , from : string ) => {
351
- if ( url . charAt ( 0 ) === '~' ) {
352
- throw new Error (
353
- `'${ from } ' imports '${ url } ' with a tilde. Usage of '~' in imports is no longer supported.` ,
354
- ) ;
355
- }
356
-
357
- return null ;
358
- } ,
359
- // Prevent use of `fibers` package as it no longer works in newer Node.js versions
360
- fiber : false ,
361
- indentedSyntax,
362
- // bootstrap-sass requires a minimum precision of 8
363
- precision : 8 ,
364
- includePaths,
365
- // Use expanded as otherwise sass will remove comments that are needed for autoprefixer
366
- // Ex: /* autoprefixer grid: autoplace */
367
- // See: https://github.com/webpack-contrib/sass-loader/blob/45ad0be17264ceada5f0b4fb87e9357abe85c4ff/src/getSassOptions.js#L68-L70
368
- outputStyle : 'expanded' ,
369
- // Silences compiler warnings from 3rd party stylesheets
370
- quietDeps : ! verbose ,
371
- verbose,
372
- } ,
373
- } ;
319
+ return {
320
+ sourceMap : true ,
321
+ api : 'modern' ,
322
+ implementation,
323
+ // Webpack importer is only implemented in the legacy API and we have our own custom Webpack importer.
324
+ // See: https://github.com/webpack-contrib/sass-loader/blob/997f3eb41d86dd00d5fa49c395a1aeb41573108c/src/utils.js#L642-L651
325
+ webpackImporter : false ,
326
+ sassOptions : ( loaderContext : LoaderContext < { } > ) => ( {
327
+ importers : [ getSassResolutionImporter ( loaderContext , root , preserveSymlinks ) ] ,
328
+ loadPaths : includePaths ,
329
+ // Use expanded as otherwise sass will remove comments that are needed for autoprefixer
330
+ // Ex: /* autoprefixer grid: autoplace */
331
+ // See: https://github.com/webpack-contrib/sass-loader/blob/45ad0be17264ceada5f0b4fb87e9357abe85c4ff/src/getSassOptions.js#L68-L70
332
+ style : 'expanded' ,
333
+ // Silences compiler warnings from 3rd party stylesheets
334
+ quietDeps : ! verbose ,
335
+ verbose,
336
+ syntax : indentedSyntax ? 'indented' : 'scss' ,
337
+ sourceMapIncludeSources : true ,
338
+ } ) ,
339
+ } ;
374
340
}
375
341
376
342
function getSassResolutionImporter (
0 commit comments