简体   繁体   中英

How can I fix a Laravel Mix build error in Laravel 7

Working with Laravel 7 my resources->sass->app.scss is like the following:

@import "variables";

@import "node_modules/font-awesome/scss/font-awesome";

@import "node_modules/bulma/bulma";

@import "node_modules/buefy/src/scss/buefy";

However, Laravel mix returns a build error here like

ModuleBuild Error Module build faild (from./node module /saas-loader/dist/cjs.js);\rSaasError:cant find stylesheet to import.\r' @import "variables";

How can I fix this problem?

Have you actually created the variables.scss file?

Laravel doesn't create this by default unless you run one of laravel/ui presets: bootstrap, vue, react

If you don't have a _variables.scss , then remove the reference. This is the right way to reference the /node_modules directory.

// Fontawesome
@import '~@fortawesome/fontawesome-free/scss/fontawesome';
@import '~@fortawesome/fontawesome-free/scss/regular';
@import '~@fortawesome/fontawesome-free/scss/solid';
@import '~@fortawesome/fontawesome-free/scss/brands';

// Bulma
@import '~bulma/bulma';

// Buefy
@import '~buefy/src/scss/buefy';

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM