From b931dd40cea828021f3092d1e224053a1baacba0 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Tue, 22 Aug 2017 00:38:39 +0430 Subject: [PATCH] fix sass loader with indentedSyntax fixes #1436 query options cannot be used when options provided --- lib/builder/webpack/base.config.js | 2 +- lib/builder/webpack/style-loader.js | 13 ++++++------- lib/builder/webpack/vue-loader.config.js | 2 +- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/lib/builder/webpack/base.config.js b/lib/builder/webpack/base.config.js index 25fc2f1b75..3da78d2640 100644 --- a/lib/builder/webpack/base.config.js +++ b/lib/builder/webpack/base.config.js @@ -74,7 +74,7 @@ export default function webpackBaseConfig (name) { }, { test: /\.css$/, use: this.styleLoader('css') }, { test: /\.less$/, use: this.styleLoader('less', 'less-loader') }, - { test: /\.sass$/, use: this.styleLoader('sass', 'sass-loader?indentedSyntax') }, + { test: /\.sass$/, use: this.styleLoader('sass', {loader: 'sass-loader', options: { indentedSyntax: true }}) }, { test: /\.scss$/, use: this.styleLoader('scss', 'sass-loader') }, { test: /\.styl(us)?$/, use: this.styleLoader('stylus', 'stylus-loader') }, { diff --git a/lib/builder/webpack/style-loader.js b/lib/builder/webpack/style-loader.js index c20b6fbdb4..ec1b25607e 100755 --- a/lib/builder/webpack/style-loader.js +++ b/lib/builder/webpack/style-loader.js @@ -5,14 +5,13 @@ export default function styleLoader (ext, loaders = [], isVueLoader = false) { // Normalize loaders loaders = (Array.isArray(loaders) ? loaders : [loaders]).map(loader => { if (typeof loader === 'string') { - return { - loader, - options: { - sourceMap: this.options.build.cssSourceMap - } - } + loader = { loader } } - return loader + return Object.assign({ + options: { + sourceMap: this.options.build.cssSourceMap + } + }, loader) }) // https://github.com/postcss/postcss-loader diff --git a/lib/builder/webpack/vue-loader.config.js b/lib/builder/webpack/vue-loader.config.js index e440ef97c9..c0f70a7d20 100644 --- a/lib/builder/webpack/vue-loader.config.js +++ b/lib/builder/webpack/vue-loader.config.js @@ -14,7 +14,7 @@ export default function vueLoader () { 'css': this.styleLoader('css', [], true), 'less': this.styleLoader('less', 'less-loader', true), 'scss': this.styleLoader('scss', 'sass-loader', true), - 'sass': this.styleLoader('sass', 'sass-loader?indentedSyntax', true), + 'sass': this.styleLoader('sass', {loader: 'sass-loader', options: { indentedSyntax: true }}, true), 'stylus': this.styleLoader('stylus', 'stylus-loader', true), 'styl': this.styleLoader('stylus', 'stylus-loader', true) },