mirror of
https://github.com/vitejs/vite.git
synced 2024-11-21 22:59:10 +00:00
fix(sass): reorder sass importers (#10101)
This commit is contained in:
parent
f29fef5dc3
commit
a5437319da
@ -1441,8 +1441,8 @@ const scss: SassStylePreprocessor = async (
|
||||
const importer = [internalImporter]
|
||||
if (options.importer) {
|
||||
Array.isArray(options.importer)
|
||||
? importer.push(...options.importer)
|
||||
: importer.push(options.importer)
|
||||
? importer.unshift(...options.importer)
|
||||
: importer.unshift(options.importer)
|
||||
}
|
||||
|
||||
const { content: data, map: additionalMap } = await getSource(
|
||||
|
@ -3,6 +3,7 @@
|
||||
@import 'css-dep'; // package w/ sass entry points
|
||||
@import 'virtual-dep'; // virtual file added through importer
|
||||
@import '@/pkg-dep'; // package w/out sass field
|
||||
@import '@/weapp.wxss'; // wxss file
|
||||
|
||||
.sass {
|
||||
/* injected via vite.config.js */
|
||||
|
@ -45,9 +45,14 @@ module.exports = {
|
||||
preprocessorOptions: {
|
||||
scss: {
|
||||
additionalData: `$injectedColor: orange;`,
|
||||
importer(url) {
|
||||
if (url === 'virtual-dep') return { contents: '' }
|
||||
}
|
||||
importer: [
|
||||
function (url) {
|
||||
return url === 'virtual-dep' ? { contents: '' } : null
|
||||
},
|
||||
function (url) {
|
||||
return url.endsWith('.wxss') ? { contents: '' } : null
|
||||
}
|
||||
]
|
||||
},
|
||||
styl: {
|
||||
additionalData: `$injectedColor ?= orange`,
|
||||
|
0
playground/css/weapp.wxss
Normal file
0
playground/css/weapp.wxss
Normal file
Loading…
Reference in New Issue
Block a user