File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -82,6 +82,7 @@ HtmlWebpackInlineSourcePlugin.prototype.resolveSourceMaps = function (compilatio
82
82
83
83
HtmlWebpackInlineSourcePlugin . prototype . processTag = function ( compilation , regex , tag , filename ) {
84
84
var assetUrl ;
85
+ var preTag = tag ;
85
86
86
87
// inline js
87
88
if ( tag . tagName === 'script' && tag . attributes && regex . test ( tag . attributes . src ) ) {
@@ -115,8 +116,12 @@ HtmlWebpackInlineSourcePlugin.prototype.processTag = function (compilation, rege
115
116
}
116
117
var assetName = path . posix . relative ( publicUrlPrefix , assetUrl ) ;
117
118
var asset = getAssetByName ( compilation . assets , assetName ) ;
118
- var updatedSource = this . resolveSourceMaps ( compilation , assetName , asset ) ;
119
- tag . innerHTML = ( tag . tagName === 'script' ) ? updatedSource . replace ( / ( < ) ( \/ s c r i p t > ) / g, '\\x3C$2' ) : updatedSource ;
119
+ if ( compilation . assets [ assetName ] !== undefined ) {
120
+ var updatedSource = this . resolveSourceMaps ( compilation , assetName , asset ) ;
121
+ tag . innerHTML = ( tag . tagName === 'script' ) ? updatedSource . replace ( / ( < ) ( \/ s c r i p t > ) / g, '\\x3C$2' ) : updatedSource ;
122
+ } else {
123
+ return preTag ;
124
+ }
120
125
}
121
126
122
127
return tag ;
You can’t perform that action at this time.
0 commit comments