@@ -2,6 +2,7 @@ const path = require('path')
2
2
const fs = require ( 'fs' )
3
3
const consola = require ( 'consola' )
4
4
const merge = require ( 'deepmerge' )
5
+ const dartSass = require ( 'sass' )
5
6
6
7
const defaults = {
7
8
customVariables : [ ] ,
@@ -20,13 +21,6 @@ const cdn = {
20
21
'fa4' :
'https://cdn.jsdelivr.net/npm/[email protected] /css/font-awesome.min.css'
21
22
}
22
23
23
- const sassLoaderOptions = {
24
- implementation : require ( 'sass' ) ,
25
- sassOptions : {
26
- indentedSyntax : true
27
- }
28
- }
29
-
30
24
module . exports = function ( moduleOptions ) {
31
25
this . nuxt . hook ( 'build:before' , ( ) => {
32
26
const options = merge . all ( [
@@ -44,13 +38,20 @@ module.exports = function (moduleOptions) {
44
38
}
45
39
46
40
// Ensure sass-loader@8 compatibility (https://github.com/webpack-contrib/sass-loader/releases/tag/v8.0.0)
41
+ // Cause since loader options validation, this will fail: https://github.com/nuxt/nuxt.js/tree/c8ee9a660809e856c28d8678c6a632bbdd6ed00f/packages/config/src/config/build.js#L50
47
42
delete this . options . build . loaders . sass . indentedSyntax
48
- this . options . build . loaders . sass . prependData = this . options . build . loaders . sass . data
49
- delete this . options . build . loaders . sass . data
50
43
51
- // Customize sass-loader options
52
- Object . assign ( this . options . build . loaders . scss , sassLoaderOptions )
53
- Object . assign ( this . options . build . loaders . sass , sassLoaderOptions )
44
+ // Customize sass & scss loaders options
45
+ Object . assign ( this . options . build . loaders . sass , {
46
+ implementation : dartSass ,
47
+ sassOptions : {
48
+ indentedSyntax : true
49
+ }
50
+ } )
51
+
52
+ Object . assign ( this . options . build . loaders . scss , {
53
+ implementation : dartSass
54
+ } )
54
55
55
56
// Custom variables
56
57
const sassLoaderData = this . options . build . loaders . sass . prependData
0 commit comments