File tree 4 files changed +11
-5
lines changed
packages/vite/src/node/plugins
4 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -1441,8 +1441,8 @@ const scss: SassStylePreprocessor = async (
1441
1441
const importer = [ internalImporter ]
1442
1442
if ( options . importer ) {
1443
1443
Array . isArray ( options . importer )
1444
- ? importer . push ( ...options . importer )
1445
- : importer . push ( options . importer )
1444
+ ? importer . unshift ( ...options . importer )
1445
+ : importer . unshift ( options . importer )
1446
1446
}
1447
1447
1448
1448
const { content : data , map : additionalMap } = await getSource (
Original file line number Diff line number Diff line change 3
3
@import ' css-dep' ; // package w/ sass entry points
4
4
@import ' virtual-dep' ; // virtual file added through importer
5
5
@import ' @/pkg-dep' ; // package w/out sass field
6
+ @import ' @/weapp.wxss' ; // wxss file
6
7
7
8
.sass {
8
9
/* injected via vite.config.js */
Original file line number Diff line number Diff line change @@ -45,9 +45,14 @@ module.exports = {
45
45
preprocessorOptions : {
46
46
scss : {
47
47
additionalData : `$injectedColor: orange;` ,
48
- importer ( url ) {
49
- if ( url === 'virtual-dep' ) return { contents : '' }
50
- }
48
+ importer : [
49
+ function ( url ) {
50
+ return url === 'virtual-dep' ? { contents : '' } : null
51
+ } ,
52
+ function ( url ) {
53
+ return url . endsWith ( '.wxss' ) ? { contents : '' } : null
54
+ }
55
+ ]
51
56
} ,
52
57
styl : {
53
58
additionalData : `$injectedColor ?= orange` ,
You can’t perform that action at this time.
0 commit comments