Skip to content

Using sourceMap with sass-resources-loaderΒ #55

@Igor-Vuk

Description

@Igor-Vuk

Hi guys. I am using sourceMap and sass-resources-loader together. Everything works fine but there is a problem with line number when looking at my source code.

For example. This is the code when looking in code console

1  $lightblue: #00D8FF;
2  $blue: #2C3949;
3  $gray: #333333;
4.  /* Home scene */
5.  $text-color: $lightblue;
6. .container {
7. .align-center {
8.      text-align: center;
9.  }

And this is my code

1.  /* Home scene */
2.  $text-color: $lightblue;
3. .container {
4. .align-center {
5.      text-align: center;
6.  }

Since sass-resources-loader imports my variables at the top I get incorect line number in console. How do I resolve this?

This is my config in webpack

{
        test: /\.local\.(css|scss)$/,
        use: [
          'style-loader',
          'css-loader?sourceMap&modules&importLoaders=1&localIdentName=[path]___[name]__[local]___[hash:base64:5]',
          'postcss-loader?sourceMap',
          'sass-loader?sourceMap',
          {
            loader: 'sass-resources-loader',
            options: {
              resources: [
                path.resolve(__dirname, './src/client/styles/scss/variables.scss'),
              ],
            },
          },
        ],
      },

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions