Skip to main content

¿Por que webpackWebpack me da este error al compilar sass?

       ERROR in ./src/scss/main.scss (./node_modules/css-loader/dist/cjs.js!./node_modules/style-loader/dist!./node_modules/postcss-loader/src!./node_modules/sass-loader/dist/cjs.js!./src/scss/main.scss)
       Module build failed (from ./node_modules/css-loader/dist/cjs.js):
       CssSyntaxError
       
      
    (1:1) Unknown word
       
     
    > 1 | var content = require("!!../../node_modules/postcss-loader/src/index.js!../../node_modules/sass-loader/dist/cjs.js!./main.scss");
           | ^
         2 | 
         3 | if (typeof content === 'string') {
module.exports = {
    module: {
        rules: [
            {
                test: /\.(le|sc|sa|c)ss$/,
                exclude: /node_modules/,
                use: [
                    {
                        loader: MiniCss.loader,
                        options: {
                            hmr: process.env.NODE_ENV === 'development',
                        },
                    },
                    'css-loader',
                    'style-loader',
                    'postcss-loader',
                    'sass-loader',
                    'less-loader'
                ],

            }
        ]
    }
}

¿Por que webpack me da este error al compilar sass?

       ERROR in ./src/scss/main.scss (./node_modules/css-loader/dist/cjs.js!./node_modules/style-loader/dist!./node_modules/postcss-loader/src!./node_modules/sass-loader/dist/cjs.js!./src/scss/main.scss)
       Module build failed (from ./node_modules/css-loader/dist/cjs.js):
       CssSyntaxError
       
        (1:1) Unknown word
       
        > 1 | var content = require("!!../../node_modules/postcss-loader/src/index.js!../../node_modules/sass-loader/dist/cjs.js!./main.scss");
           | ^
         2 | 
         3 | if (typeof content === 'string') {
module.exports = {
    module: {
        rules: [{
            test: /\.(le|sc|sa|c)ss$/,
            exclude: /node_modules/,
            use: [{
                    loader: MiniCss.loader,
                    options: {
                        hmr: process.env.NODE_ENV === 'development',
                    },
                },
                'css-loader',
                'style-loader',
                'postcss-loader',
                'sass-loader',
                'less-loader'
            ],

        }]
    }
}

¿Por que Webpack me da este error al compilar sass?

ERROR in ./src/scss/main.scss (./node_modules/css-loader/dist/cjs.js!./node_modules/style-loader/dist!./node_modules/postcss-loader/src!./node_modules/sass-loader/dist/cjs.js!./src/scss/main.scss)
    Module build failed (from ./node_modules/css-loader/dist/cjs.js):
    CssSyntaxError
            
    (1:1) Unknown word
           
    > 1 | var content = require("!!../../node_modules/postcss-loader/src/index.js!../../node_modules/sass-loader/dist/cjs.js!./main.scss");
        | ^
      2 | 
      3 | if (typeof content === 'string') {
module.exports = {
    module: {
        rules: [
            {
                test: /\.(le|sc|sa|c)ss$/,
                exclude: /node_modules/,
                use: [
                    {
                        loader: MiniCss.loader,
                        options: {
                            hmr: process.env.NODE_ENV === 'development',
                        },
                    },
                    'css-loader',
                    'style-loader',
                    'postcss-loader',
                    'sass-loader',
                    'less-loader'
                ],

            }
        ]
    }
}
se añadieron 466 caracteres en el cuerpo; se eliminaron 21 caracteres en el cuerpo
Origen Enlace
Rimuru Tempest
  • 2.6k
  • 4
  • 22
  • 39

¿Por que webpack me da este error al compilar csssass?

Uso múltiples loaders para los estilos, como sass-loader, style-loader, less-loader, postcss-loader, css-loader para compilar estilos .scss y la consola me da este error:

       ERROR in ./src/scss/main.scss (./node_modules/css-loader/dist/cjs.js!./node_modules/style-loader/dist!./node_modules/postcss-loader/src!./node_modules/sass-loader/dist/cjs.js!./src/scss/main.scss)
       Module build failed (from ./node_modules/css-loader/dist/cjs.js):
       CssSyntaxError
       
       (1:1) Unknown word
       
       > 1 | var content = require("!!../../node_modules/postcss-loader/src/index.js!../../node_modules/sass-loader/dist/cjs.js!./main.scss");
           | ^
         2 | 
         3 | if (typeof content === 'string') {

La configuración de mi archivo webpack.config.prod.js es este:

module.exports = {
    module: {
        rules: [{
            test: /\.(le|sc|sa|c)ss$/,
            exclude: /node_modules/,
            use: [{
                    loader: MiniCss.loader,
                    options: {
                        hmr: process.env.NODE_ENV === 'development',
                    },
                },
                'css-loader',
                'style-loader',
                'postcss-loader',
                'sass-loader',
                'less-loader'
            ],

        }]
    }
}

¿Por que webpack me da este error al compilar css?

Uso múltiples loaders para los estilos, como sass-loader, style-loader, less-loader, postcss-loader, css-loader para compilar estilos .scss y la consola me da este error:

       ERROR in ./src/scss/main.scss (./node_modules/css-loader/dist/cjs.js!./node_modules/style-loader/dist!./node_modules/postcss-loader/src!./node_modules/sass-loader/dist/cjs.js!./src/scss/main.scss)
       Module build failed (from ./node_modules/css-loader/dist/cjs.js):
       CssSyntaxError
       
       (1:1) Unknown word
       
       > 1 | var content = require("!!../../node_modules/postcss-loader/src/index.js!../../node_modules/sass-loader/dist/cjs.js!./main.scss");
           | ^
         2 | 
         3 | if (typeof content === 'string') {

¿Por que webpack me da este error al compilar sass?

Uso múltiples loaders para los estilos, como sass-loader, style-loader, less-loader, postcss-loader, css-loader para compilar estilos .scss y la consola me da este error:

       ERROR in ./src/scss/main.scss (./node_modules/css-loader/dist/cjs.js!./node_modules/style-loader/dist!./node_modules/postcss-loader/src!./node_modules/sass-loader/dist/cjs.js!./src/scss/main.scss)
       Module build failed (from ./node_modules/css-loader/dist/cjs.js):
       CssSyntaxError
       
       (1:1) Unknown word
       
       > 1 | var content = require("!!../../node_modules/postcss-loader/src/index.js!../../node_modules/sass-loader/dist/cjs.js!./main.scss");
           | ^
         2 | 
         3 | if (typeof content === 'string') {

La configuración de mi archivo webpack.config.prod.js es este:

module.exports = {
    module: {
        rules: [{
            test: /\.(le|sc|sa|c)ss$/,
            exclude: /node_modules/,
            use: [{
                    loader: MiniCss.loader,
                    options: {
                        hmr: process.env.NODE_ENV === 'development',
                    },
                },
                'css-loader',
                'style-loader',
                'postcss-loader',
                'sass-loader',
                'less-loader'
            ],

        }]
    }
}
Origen Enlace
Rimuru Tempest
  • 2.6k
  • 4
  • 22
  • 39

¿Por que webpack me da este error al compilar css?

Uso múltiples loaders para los estilos, como sass-loader, style-loader, less-loader, postcss-loader, css-loader para compilar estilos .scss y la consola me da este error:

       ERROR in ./src/scss/main.scss (./node_modules/css-loader/dist/cjs.js!./node_modules/style-loader/dist!./node_modules/postcss-loader/src!./node_modules/sass-loader/dist/cjs.js!./src/scss/main.scss)
       Module build failed (from ./node_modules/css-loader/dist/cjs.js):
       CssSyntaxError
       
       (1:1) Unknown word
       
       > 1 | var content = require("!!../../node_modules/postcss-loader/src/index.js!../../node_modules/sass-loader/dist/cjs.js!./main.scss");
           | ^
         2 | 
         3 | if (typeof content === 'string') {