@@ -183,6 +183,29 @@ export default function PluginVue(userOptions: Partial<Options> = {}): Plugin {
183
183
} else if ( query . type === 'style' ) {
184
184
debug ( `transform(${ id } )` )
185
185
const block = descriptor . styles [ query . index ] !
186
+
187
+ let preprocessOptions = options . preprocessOptions || { }
188
+ const preprocessLang = ( options . preprocessStyles
189
+ ? block . lang
190
+ : undefined ) as SFCAsyncStyleCompileOptions [ 'preprocessLang' ]
191
+
192
+ if ( preprocessLang ) {
193
+ preprocessOptions =
194
+ preprocessOptions [ preprocessLang ] || preprocessOptions
195
+
196
+ if (
197
+ [ 'scss' , 'sass' ] . includes ( preprocessLang ) &&
198
+ ! preprocessOptions . includePaths
199
+ ) {
200
+ preprocessOptions = {
201
+ includePaths : [ 'node_modules' ] ,
202
+ ...preprocessOptions ,
203
+ }
204
+ }
205
+ } else {
206
+ preprocessOptions = { }
207
+ }
208
+
186
209
const result = await compileStyleAsync ( {
187
210
filename : query . filename ,
188
211
id : `data-v-${ query . id ! } ` ,
@@ -192,11 +215,9 @@ export default function PluginVue(userOptions: Partial<Options> = {}): Plugin {
192
215
postcssOptions : options . postcssOptions ,
193
216
postcssPlugins : options . postcssPlugins ,
194
217
modulesOptions : options . cssModulesOptions ,
195
- preprocessLang : options . preprocessStyles
196
- ? ( block . lang as any )
197
- : undefined ,
218
+ preprocessLang,
198
219
preprocessCustomRequire : options . preprocessCustomRequire ,
199
- preprocessOptions : options . preprocessOptions || { } ,
220
+ preprocessOptions,
200
221
} )
201
222
202
223
if ( result . errors . length ) {
0 commit comments