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