rsbuild: [Bug]: SCSS files not loaded

Version

System:
    OS: Linux 5.15 Ubuntu 20.04.6 LTS (Focal Fossa)
    CPU: (8) x64 11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz
    Memory: 11.40 GB / 15.48 GB
    Container: Yes
    Shell: 5.0.17 - /bin/bash
  npmPackages:
    @rsbuild/core: 0.5.2 => 0.5.2 
    @rsbuild/plugin-eslint: ^0.5.2 => 0.5.2 
    @rsbuild/plugin-react: 0.5.2 => 0.5.2

Details

I’m currently migrating from RsPack to RsBuild but SCSS seems to not be loaded.

Here is how I config it in RsPack

{
  test: /\.scss$/,
  use: [
    'style-loader',
    {
      loader: 'css-loader',
      options: {
        importLoaders: 3,
        sourceMap: false,
        modules: {
          mode: 'icss',
        },
      },
    },
    {
      loader: 'postcss-loader',
      options: {
        postcssOptions: {
          ident: 'postcss',
          config: false,
          sourceMap: false,
          
        },
      },
    },
    {
      loader: 'resolve-url-loader',
    },
    {
      loader: 'sass-loader',
      options: {
        sourceMap: true,
        
      },
    },
  ],
}

But in RsBuild I tried some things with styleLoader and postscss but is not loading scss files (it load it as undefined).

How should it load it?

Reproduce link

https://github.com/JoseBuendiaDigio/rsbuild-scss

Reproduce Steps

rsbuild build and rsbuild dev

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 16 (7 by maintainers)

Most upvoted comments

@JoseBuendiaDigio You can set namedExport: false in tools.cssLoader.modules option

tools: { cssLoader() { return { modules: { mode: "icss", namedExport: false, }, }; }, }

Because if tools.cssLoader is a function type, the return value is the final configuration

Is right? @chenjiahan