Skip to content

Commit e63bf61

Browse files
authored
fix: avoid accidentally overriding sass config with scss configs (#4637)
1 parent b823ca8 commit e63bf61

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

packages/@vue/cli-service/__tests__/css.spec.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,8 @@ test('scss loaderOptions', () => {
347347
prependData: sassData
348348
},
349349
scss: {
350-
prependData: scssData
350+
prependData: scssData,
351+
webpackImporter: false
351352
}
352353
}
353354
}
@@ -365,6 +366,9 @@ test('scss loaderOptions', () => {
365366
},
366367
sourceMap: false
367368
})
369+
370+
// should not merge scss options into default sass config
371+
expect(findOptions(config, 'sass', 'sass')).not.toHaveProperty('webpackImporter')
368372
})
369373

370374
test('should use dart sass implementation whenever possible', () => {

packages/@vue/cli-service/lib/config/css.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,11 +187,13 @@ module.exports = (api, rootOptions) => {
187187
createCSSRule('css', /\.css$/)
188188
createCSSRule('postcss', /\.p(ost)?css$/)
189189
createCSSRule('scss', /\.scss$/, 'sass-loader', Object.assign(
190+
{},
190191
defaultSassLoaderOptions,
191192
loaderOptions.scss || loaderOptions.sass
192193
))
193194
if (sassLoaderVersion < 8) {
194195
createCSSRule('sass', /\.sass$/, 'sass-loader', Object.assign(
196+
{},
195197
defaultSassLoaderOptions,
196198
{
197199
indentedSyntax: true
@@ -200,6 +202,7 @@ module.exports = (api, rootOptions) => {
200202
))
201203
} else {
202204
createCSSRule('sass', /\.sass$/, 'sass-loader', Object.assign(
205+
{},
203206
defaultSassLoaderOptions,
204207
loaderOptions.sass,
205208
{

0 commit comments

Comments
 (0)