File tree Expand file tree Collapse file tree 2 files changed +17
-8
lines changed Expand file tree Collapse file tree 2 files changed +17
-8
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,12 @@ export default function createCache(config: ResolvedConfig) {
13
13
if ( ! descriptorCache . has ( filename ) ) {
14
14
const { descriptor, errors } = compiler . parse (
15
15
fs . readFileSync ( filename , "utf8" ) . toString ( ) ,
16
- { filename }
16
+ {
17
+ filename,
18
+ sourceMap :
19
+ config . command === "build" ? ! ! config . build . sourcemap : true ,
20
+ sourceRoot : config . root ,
21
+ }
17
22
) ;
18
23
if ( errors . length > 0 ) {
19
24
throw errors [ 0 ] ;
Original file line number Diff line number Diff line change @@ -37,14 +37,18 @@ export default function vueNestedSFC(): PluginOption {
37
37
38
38
const descriptor = cache . getDescriptor ( filename ) ;
39
39
40
- return (
41
- descriptor . customBlocks . find (
42
- ( block ) =>
43
- block . type === "component" &&
44
- typeof block . attrs . name === "string" &&
45
- pascalCase ( block . attrs . name ) === component
46
- ) ?. content || ""
40
+ const componentBlock = descriptor . customBlocks . find (
41
+ ( block ) =>
42
+ block . type === "component" &&
43
+ typeof block . attrs . name === "string" &&
44
+ pascalCase ( block . attrs . name ) === component
47
45
) ;
46
+
47
+ if ( ! componentBlock ) {
48
+ return "" ;
49
+ }
50
+
51
+ return { code : componentBlock . content , map : componentBlock . map as any } ;
48
52
} ,
49
53
50
54
transform ( code , id ) {
You can’t perform that action at this time.
0 commit comments