question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ERROR with compiling sass file

See original GitHub issue

I’ve migrated webpack from 4 to 5. Running into issues with sass loader. How to approach this problem?

module: {
            rules: [
                {
                    test: /\.worker\.ts$/,
                    use: ['workerize-loader'],
                    exclude: path.resolve(__dirname, 'node_modules'),
                },
                {
                    test: /\.(ts|js)x?$/,
                    exclude: /node_modules/,
                    use: ['awesome-typescript-loader'],
                    enforce:'pre'
                },
                {
                    test: /\.html$/,
                    use: ['html-loader']
                },
                {
                    test: /\.s[ac]ss$/i,
                    use: [
                        "style-loader",
                        "css-loader",
                        {
                            loader: "sass-loader",
                            options: {
                                // Prefer `dart-sass`
                                implementation: require("sass"),
                                sassOptions: {
                                    fiber: false,
                                },
                            },
                        },
                    ],
                },
                {
                    test: /\.(png|woff|woff2|eot|ttf|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
                    use: ['url-loader']
                }
            ],
        },
        resolve: {
            'extensions': ['.js', '.jsx', '.ts', '.tsx']
        },

ERROR in ./assets/scss/index/index_PA.scss (./node_modules/css-loader/dist/cjs.js!./node_modules/sass-loader/lib/loader.js??ruleSet[1].rules[3].use[2]!./node_modules/file-loader/dist/cjs.js??ruleSet[1].rules[6].oneOf[1]!./assets/scss/index/index_PA.scss) Module build failed (from ./node_modules/sass-loader/lib/loader.js):

@import ‘…/vendors/bootstrap-4.3.1/css/bootstrap’; ^ Expected “{”. ╷ 1 │ export default webpack_public_path + “static/media/index_PA.c1419108.scss”; │ ^ ╵ stdin 1:79 root stylesheet in /Users/spa/assets/scss/index/index_PA.scss (line 1, column 79)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
alexander-akaitcommented, Jun 3, 2021

@priya454

Here template https://github.com/webpack-contrib/sass-loader/issues/new?assignees=&labels=&template=BUG.md

But can you explain how you figured out that “file-loader” is missing

Based on error message, look at file-loader/css-loader/etc works, they should have the right order, i.e. firstly file-loader, then css-loader, then sass-loader and etc

Note: file-loader is deprecated (they still will work for webpack v5), but I strongly recommend migrate on https://webpack.js.org/guides/asset-modules/ (better support, more abilities, faster, no extra deps).

0reactions
priya454commented, Jun 3, 2021

@alexander-akait I added “file-loader” before style-loader and css-loader. It fixed the issue. But can you explain how you figured out that “file-loader” is missing

{
                    test: /\.s[ac]ss$/i,
                    use: [
                         **"file-loader"**,
                        "style-loader",
                        "css-loader",
                        {
                            loader: "sass-loader",
                            options: {
                                // Prefer `dart-sass`
                                implementation: require("sass"),
                                sassOptions: {
                                    fiber: false,
                                },
                            },
                        },
                    ],
                },
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to resolve this Sass compiling error? - css - Stack Overflow
the error says that there's no container.scss file or it's unreachable and you're trying to import it, check typos for the file name...
Read more >
Sass compilation error - HTML-CSS - The freeCodeCamp Forum
I try to compile my sass code to css using the command: “npm run compile_sass” but keeps getting this error message below:
Read more >
Sass: @error
It prints the value of the expression (usually a string) along with a stack trace indicating how the current mixin or function was...
Read more >
Compile sass Error: File to read not found or unreadable #2022
First make sure the file is there. ... When the sass file is modified for the first time will be prompted to save...
Read more >
CSS Compile Error - Material Design for Bootstrap
Hello, I am trying to set the order of SCSS files in my main SCSS file. I'd like to compile in the following...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found