File tree Expand file tree Collapse file tree 2 files changed +16
-7
lines changed Expand file tree Collapse file tree 2 files changed +16
-7
lines changed Original file line number Diff line number Diff line change @@ -130,13 +130,19 @@ export function sveltePreprocess(
130
130
const [ propPath , value ] = SOURCE_MAP_PROP_MAP [ name ] ;
131
131
const pathParts = propPath . split ( '.' ) ;
132
132
let parentObj = opts ;
133
- let i ;
134
- for ( i = 0 ; i < pathParts . length - 1 ; i ++ ) {
133
+
134
+ for ( let i = 0 ; i < pathParts . length - 1 ; i ++ ) {
135
135
const propName = pathParts [ i ] ;
136
- if ( typeof parentObj [ propName ] !== 'object' ) parentObj [ propName ] = { } ;
136
+
137
+ if ( typeof parentObj [ propName ] !== 'object' ) {
138
+ parentObj [ propName ] = { } ;
139
+ }
140
+
137
141
parentObj = parentObj [ propName ] ;
138
142
}
139
- const propName = pathParts [ i ] ;
143
+
144
+ const propName = pathParts [ pathParts . length - 1 ] ;
145
+
140
146
parentObj [ propName ] = value ;
141
147
}
142
148
Original file line number Diff line number Diff line change @@ -88,13 +88,16 @@ describe(`sourcemap generation`, () => {
88
88
const expectedOptions = { } ;
89
89
const pathParts = propPath . split ( '.' ) ;
90
90
let parentObj = expectedOptions ;
91
- let i ;
92
- for ( i = 0 ; i < pathParts . length - 1 ; i ++ ) {
91
+
92
+ for ( let i = 0 ; i < pathParts . length - 1 ; i ++ ) {
93
93
const propName = pathParts [ i ] ;
94
+
94
95
parentObj [ propName ] = { } ;
95
96
parentObj = parentObj [ propName ] ;
96
97
}
97
- const propName = pathParts [ i ] ;
98
+
99
+ const propName = pathParts [ pathParts . length - 1 ] ;
100
+
98
101
parentObj [ propName ] = value ;
99
102
100
103
await preprocess ( template , opts ) ;
You can’t perform that action at this time.
0 commit comments