File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed
packages/@vue/cli-service/lib/webpack Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ class ModernModePlugin {
3737 compiler . hooks . compilation . tap ( ID , compilation => {
3838 compilation . hooks . htmlWebpackPluginAlterAssetTags . tapAsync ( ID , async ( data , cb ) => {
3939 // use <script type="module"> for modern assets
40- const modernAssets = data . body . filter ( a => a . tagName === 'script' )
40+ const modernAssets = data . body . filter ( a => a . tagName === 'script' && a . attributes )
4141 modernAssets . forEach ( a => {
4242 a . attributes . type = 'module'
4343 a . attributes . crossorigin = 'use-credentials'
@@ -54,7 +54,7 @@ class ModernModePlugin {
5454 const htmlName = path . basename ( data . plugin . options . filename )
5555 const tempFilename = path . join ( this . targetDir , `legacy-assets-${ htmlName } .json` )
5656 const legacyAssets = JSON . parse ( await fs . readFile ( tempFilename , 'utf-8' ) )
57- . filter ( a => a . tagName === 'script' )
57+ . filter ( a => a . tagName === 'script' && a . attributes )
5858 legacyAssets . forEach ( a => { a . attributes . nomodule = '' } )
5959 data . body . push ( ...legacyAssets )
6060 await fs . remove ( tempFilename )
You can’t perform that action at this time.
0 commit comments