mardi 24 juillet 2018

Laravel-mix custom rules not working?

I am trying to use this package to use my scss as javascript objects in my React part of my Laravel project.

Now when I try do add the rule to my webpack.mix.js folder I always get the following error for all my .scss files

ERROR in ./node_modules/css-loader??ref--5-2!./node_modules/postcss-loader/lib??postcss!./node_modules/resolve-url-loader??ref--5-4!./node_modules/sass-loader/lib/loader.js??ref--5-5!./node_modules/css-loader??ref--9-0!./resources/assets/sass/app.scss
Module build failed: 

^
      Invalid CSS after "e": expected 1 selector or at-rule, was "exports = module.ex"
      in /Users/user/Desktop/project/resources/assets/sass/app.scss (line 1, column 1)
 @ ./resources/assets/sass/app.scss 2:14-318
 @ multi ./resources/assets/js/app.js ./resources/assets/sass/app.scss

my webpack.mix.js file:

let mix = require('laravel-mix');

/*
 |--------------------------------------------------------------------------
 | Mix Asset Management
 |--------------------------------------------------------------------------
 |
 | Mix provides a clean, fluent API for defining some Webpack build steps
 | for your Laravel application. By default, we are compiling the Sass
 | file for the application as well as bundling up all the JS files.
 |
 */

mix.react('resources/assets/js/app.js', 'public/js')
   .sass('resources/assets/sass/app.scss', 'public/css');

mix.webpackConfig({
    module: {
        rules: [
            {
                test: /\.scss$/,
                use: [
                    {
                        loader: "css-loader",
                        options: {
                            modules: true
                        }
                    }
                ]
            }
        ]
    }
});



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire