11import { createRequire } from 'node:module' ;
2- import { join } from 'node:path' ;
2+ import path from 'node:path' ;
3+ import { fileURLToPath } from 'node:url' ;
34import type { RsbuildPlugin } from '@rsbuild/core' ;
45import deepmerge from 'deepmerge' ;
56import { reduceConfigsWithContext } from 'reduce-configs' ;
67import { getResolveUrlJoinFn , patchCompilerGlobalLocation } from './helpers.js' ;
78import type { PluginSassOptions , SassLoaderOptions } from './types.js' ;
89
10+ const __dirname = path . dirname ( fileURLToPath ( import . meta. url ) ) ;
911const require = createRequire ( import . meta. url ) ;
1012
1113export const PLUGIN_SASS_NAME = 'rsbuild:sass' ;
@@ -123,7 +125,7 @@ export const pluginSass = (
123125
124126 rule
125127 . use ( CHAIN_ID . USE . RESOLVE_URL )
126- . loader ( join ( __dirname , '../compiled/resolve-url-loader/index.js' ) )
128+ . loader ( path . join ( __dirname , '../compiled/resolve-url-loader/index.js' ) )
127129 . options ( {
128130 join : await getResolveUrlJoinFn ( ) ,
129131 // 'resolve-url-loader' relies on 'adjust-sourcemap-loader',
@@ -133,7 +135,7 @@ export const pluginSass = (
133135 } )
134136 . end ( )
135137 . use ( CHAIN_ID . USE . SASS )
136- . loader ( join ( __dirname , '../compiled/sass-loader/index.js' ) )
138+ . loader ( path . join ( __dirname , '../compiled/sass-loader/index.js' ) )
137139 . options ( options ) ;
138140 } ) ;
139141 } ,
0 commit comments