fix(compiler-sfc): fix preprocessor filename access

This commit is contained in:
Evan You 2020-07-16 13:34:59 -04:00
parent 6136cf874e
commit 9cb29eea3a

View File

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