]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix(compiler-sfc): fix preprocessor filename access
authorEvan You <yyx990803@gmail.com>
Thu, 16 Jul 2020 17:34:59 +0000 (13:34 -0400)
committerEvan You <yyx990803@gmail.com>
Thu, 16 Jul 2020 17:36:31 +0000 (13:36 -0400)
packages/compiler-sfc/src/stylePreprocessors.ts

index 13e9f9769fc2880c717628c4df35b96522f9b733..31a983793465fc37dbcefeee88c246fbf8710987 100644 (file)
@@ -1,12 +1,17 @@
 import merge from 'merge-source-map'
 import path from 'path'
+import { RawSourceMap } from 'source-map'
+import { SFCStyleCompileOptions } from './compileStyle'
 
 export interface StylePreprocessor {
   render(
     source: string,
-    map?: object,
-    options?: any,
-    customRequire?: (id: string) => any
+    map: RawSourceMap | undefined,
+    options: {
+      [key: string]: any
+      filename: string
+    },
+    customRequire: SFCStyleCompileOptions['preprocessCustomRequire']
   ): StylePreprocessorResults
 }
 
@@ -83,7 +88,7 @@ const less: StylePreprocessor = {
     // less output path is relative path
     const dependencies = getAbsolutePaths(
       result.imports,
-      path.dirname(options.fileName)
+      path.dirname(options.filename)
     )
     if (map) {
       return {