提交 ff6a0c47 编写于 作者: Q qiang

fix: remove sass-loader version check

上级 83c597e9
......@@ -8,10 +8,6 @@ const {
nvueCssPreprocessOptions
} = require('@dcloudio/uni-cli-shared')
const {
sassLoaderVersion
} = require('@dcloudio/uni-cli-shared/lib/scss')
const nvueStyleLoader = {
loader: '@dcloudio/vue-cli-plugin-hbuilderx/packages/webpack-uni-nvue-loader/lib/style'
}
......@@ -78,25 +74,15 @@ const sassLoader = {
}
}
if (sassLoaderVersion < 8) {
scssLoader.options.data = sassData
scssLoader.options.outputStyle = 'expanded'
sassLoader.options.data = sassData
sassLoader.options.outputStyle = 'expanded'
sassLoader.options.indentedSyntax = true
} else {
const name = sassLoaderVersion >= 9 ? 'additionalData' : 'prependData'
scssLoader.options[name] = sassData
scssLoader.options.sassOptions = {
outputStyle: 'expanded'
}
scssLoader.options.prependData = sassData
scssLoader.options.sassOptions = {
outputStyle: 'expanded'
}
sassLoader.options[name] = sassData
sassLoader.options.sassOptions = {
outputStyle: 'expanded',
indentedSyntax: true
}
sassLoader.options.prependData = sassData
sassLoader.options.sassOptions = {
outputStyle: 'expanded',
indentedSyntax: true
}
const lessLoader = {
......
const path = require('path')
const webpack = require('webpack')
const {
sassLoaderVersion
} = require('@dcloudio/uni-cli-shared/lib/scss')
const {
getPartialIdentifier
} = require('./util')
......@@ -112,21 +108,19 @@ module.exports = function chainWebpack (platformOptions, vueOptions, api) {
})
})
if (sassLoaderVersion >= 8) { // check indentedSyntax
// vue cli 3 and sass-loader 8
cssTypes.forEach(type => {
webpackConfig.module.rule('sass').oneOf(type).use('sass-loader').tap(options => {
if (options.indentedSyntax) {
if (!options.sassOptions) {
options.sassOptions = {}
}
options.sassOptions.indentedSyntax = true
delete options.indentedSyntax
// vue cli 3 and sass-loader 8
cssTypes.forEach(type => {
webpackConfig.module.rule('sass').oneOf(type).use('sass-loader').tap(options => {
if (options.indentedSyntax) {
if (!options.sassOptions) {
options.sassOptions = {}
}
return options
})
options.sassOptions.indentedSyntax = true
delete options.indentedSyntax
}
return options
})
}
})
platformOptions.chainWebpack(webpackConfig, vueOptions, api)
// define
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册