laravel.mix does't compile scss files

匆匆过客 提交于 2020-03-21 08:25:11

问题


could you help with the following problem?

My webpack.mix.js file

const mix = require('laravel-mix');
const config = require('./webpack.config');

mix.webpackConfig(config);

/*
 |--------------------------------------------------------------------------
 | 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
    .js('resources/js/app.js', 'public/js')
    .extract([
        'vue',
        'vuex',
        'axios',
        'vue-i18n',
        'vue-router'
    ])
    .sass('resources/sass/app.scss', 'public/css/app.css', {
        implementation: require('node-sass')
    });

My webpack.config.js file:

module.exports = {
    resolve: {
        alias: {
            'app': path.join(__dirname, '/resources/js'),
        }
    }
};

When I try to compile with npm run watch, I receive the following message:

 DONE  Compiled successfully in 4737ms                                                                                                                                                                                       12:33:55 PM

          Asset      Size                             Chunks             Chunk Names
   /css/app.css   0 bytes  /js/app, /js/manifest, /js/vendor  [emitted]  /js/app, /js/manifest, /js/vendor
     /js/app.js   1.7 MiB                            /js/app  [emitted]  /js/app
/js/manifest.js  8.94 KiB                       /js/manifest  [emitted]  /js/manifest
  /js/vendor.js   538 KiB                         /js/vendor  [emitted]  /js/vendor
           0.js  8.22 KiB                                  0  [emitted]  

As you can see, the app.css file generated is 0 bytes in size, but .. in the app.scss file I have the following content:

// Variables
@import 'variables';

// Bootstrap
@import '~bootstrap/scss/bootstrap';

My question is: Why if the app.scss file has content, it is not generated to the app.css file?

来源:https://stackoverflow.com/questions/59975280/laravel-mix-doest-compile-scss-files

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!