laravel.mix不编译scss文件

时间:2020-01-29 20:44:03

标签: laravel webpack laravel-mix

您可以解决以下问题吗?

我的webpack.mix.js文件

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')
    });

我的webpack.config.js文件:

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

当我尝试使用npm run watch进行编译时,收到以下消息:

 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]  

如您所见,生成的app.css文件的大小为0字节,但是在app.scss文件中的..我具有以下内容:

// Variables
@import 'variables';

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

我的问题是:为什么app.scss文件包含内容,却没有生成到app.css文件中?

0 个答案:

没有答案