1
1
import merge from 'merge-source-map'
2
- import path from 'path'
3
2
import { RawSourceMap } from 'source-map'
4
3
import { SFCStyleCompileOptions } from './compileStyle'
5
4
@@ -33,7 +32,6 @@ const scss: StylePreprocessor = (source, map, options, load = require) => {
33
32
34
33
try {
35
34
const result = nodeSass . renderSync ( finalOptions )
36
- // sass output path is position path
37
35
const dependencies = result . stats . includedFiles
38
36
if ( map ) {
39
37
return {
@@ -77,11 +75,7 @@ const less: StylePreprocessor = (source, map, options, load = require) => {
77
75
)
78
76
79
77
if ( error ) return { code : '' , errors : [ error ] , dependencies : [ ] }
80
- // less output path is relative path
81
- const dependencies = getAbsolutePaths (
82
- result . imports ,
83
- path . dirname ( options . filename )
84
- )
78
+ const dependencies = result . imports
85
79
if ( map ) {
86
80
return {
87
81
code : result . css . toString ( ) ,
@@ -107,11 +101,7 @@ const styl: StylePreprocessor = (source, map, options, load = require) => {
107
101
if ( map ) ref . set ( 'sourcemap' , { inline : false , comment : false } )
108
102
109
103
const result = ref . render ( )
110
- // stylus output path is relative path
111
- const dependencies = getAbsolutePaths (
112
- ref . deps ( ) ,
113
- path . dirname ( options . filename )
114
- )
104
+ const dependencies = ref . deps ( )
115
105
if ( map ) {
116
106
return {
117
107
code : result ,
@@ -136,7 +126,3 @@ export const processors: Record<PreprocessLang, StylePreprocessor> = {
136
126
styl,
137
127
stylus : styl
138
128
}
139
-
140
- function getAbsolutePaths ( relativePaths : string [ ] , dirname : string ) : string [ ] {
141
- return relativePaths . map ( relativePath => path . join ( dirname , relativePath ) )
142
- }
0 commit comments