@@ -183,6 +183,25 @@ 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 = preprocessOptions [ preprocessLang ] || { }
194
+ if (
195
+ [ 'scss' , 'sass' ] . includes ( preprocessLang ) &&
196
+ ! preprocessOptions . includePaths
197
+ ) {
198
+ preprocessOptions = {
199
+ includePaths : [ 'node_modules' ] ,
200
+ ...preprocessOptions ,
201
+ }
202
+ }
203
+ }
204
+
186
205
const result = await compileStyleAsync ( {
187
206
filename : query . filename ,
188
207
id : `data-v-${ query . id ! } ` ,
@@ -192,11 +211,9 @@ export default function PluginVue(userOptions: Partial<Options> = {}): Plugin {
192
211
postcssOptions : options . postcssOptions ,
193
212
postcssPlugins : options . postcssPlugins ,
194
213
modulesOptions : options . cssModulesOptions ,
195
- preprocessLang : options . preprocessStyles
196
- ? ( block . lang as any )
197
- : undefined ,
214
+ preprocessLang,
198
215
preprocessCustomRequire : options . preprocessCustomRequire ,
199
- preprocessOptions : options . preprocessOptions || { } ,
216
+ preprocessOptions,
200
217
} )
201
218
202
219
if ( result . errors . length ) {
0 commit comments