File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -248,22 +248,30 @@ export default class ReleaseWorker extends Worker {
248248 * @param {SourcemapCollectedData[] } sourceMaps — source maps passed from user after bundle
249249 */
250250 private extendReleaseInfo ( sourceMaps : SourcemapCollectedData [ ] ) : SourceMapDataExtended [ ] {
251- return sourceMaps . map ( ( file : SourcemapCollectedData ) => {
251+ return sourceMaps . flatMap ( ( file : SourcemapCollectedData ) => {
252252 /**
253253 * Decode base64 source map content
254254 */
255255 const buffer = Buffer . from ( file . payload , 'base64' ) ;
256256 const mapBodyString = buffer . toString ( ) ;
257+
258+ /**
259+ * If content is empty, return nothing for this file
260+ */
261+ if ( ! mapBodyString || mapBodyString . trim ( ) . length === 0 ) {
262+ return [ ] ;
263+ }
264+
257265 /**
258266 * @todo use more efficient method to extract "file" from big JSON
259267 */
260268 const mapContent = JSON . parse ( mapBodyString ) as RawSourceMap ;
261269
262- return {
270+ return [ {
263271 mapFileName : file . name ,
264272 originFileName : mapContent . file ,
265273 content : mapBodyString ,
266- } ;
274+ } ] ;
267275 } ) ;
268276 }
269277
You can’t perform that action at this time.
0 commit comments