提交 55a6197c 编写于 作者: fxy060608's avatar fxy060608

feat(cli): Compatible with sass-loader@9 #1861

上级 44e31c52
...@@ -25,7 +25,7 @@ const postcssLoader = { ...@@ -25,7 +25,7 @@ const postcssLoader = {
options: { options: {
sourceMap: false, sourceMap: false,
parser: require('postcss-comment'), parser: require('postcss-comment'),
plugins: [ plugins: [
require('postcss-import')({ require('postcss-import')({
resolve (id, basedir, importOptions) { resolve (id, basedir, importOptions) {
if (id.startsWith('~@/')) { if (id.startsWith('~@/')) {
...@@ -77,12 +77,13 @@ if (sassLoaderVersion < 8) { ...@@ -77,12 +77,13 @@ if (sassLoaderVersion < 8) {
sassLoader.options.outputStyle = 'expanded' sassLoader.options.outputStyle = 'expanded'
sassLoader.options.indentedSyntax = true sassLoader.options.indentedSyntax = true
} else { } else {
scssLoader.options.prependData = sassData const name = sassLoaderVersion >= 9 ? 'additionalData' : 'prependData'
scssLoader.options[name] = sassData
scssLoader.options.sassOptions = { scssLoader.options.sassOptions = {
outputStyle: 'expanded' outputStyle: 'expanded'
} }
sassLoader.options.prependData = sassData sassLoader.options[name] = sassData
sassLoader.options.sassOptions = { sassLoader.options.sassOptions = {
outputStyle: 'expanded', outputStyle: 'expanded',
indentedSyntax: true indentedSyntax: true
......
...@@ -85,8 +85,9 @@ module.exports = function initOptions (options) { ...@@ -85,8 +85,9 @@ module.exports = function initOptions (options) {
if (sassLoaderVersion < 8) { if (sassLoaderVersion < 8) {
options.css.loaderOptions.sass.data = sassData options.css.loaderOptions.sass.data = sassData
} else { } else {
options.css.loaderOptions.sass.prependData = sassData const name = sassLoaderVersion >= 9 ? 'additionalData' : 'prependData'
options.css.loaderOptions.sass[name] = sassData
} }
const userPostcssConfigPath = path.resolve(process.env.UNI_INPUT_DIR, 'postcss.config.js') const userPostcssConfigPath = path.resolve(process.env.UNI_INPUT_DIR, 'postcss.config.js')
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册