fix(vue-renderer): apply nomodule to legacy chunks (#7928)

closes #7927
This commit is contained in:
Daniel Roe 2020-08-16 18:02:10 +01:00 committed by GitHub
parent 37c903fae8
commit f1a95c8af8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -48,7 +48,7 @@ export default class ModernRenderer extends SSRRenderer {
const scripts = super.renderScripts(renderContext) const scripts = super.renderScripts(renderContext)
if (this.isServerMode) { if (this.isServerMode) {
return scripts.replace('<script', `<script nomodule`) return scripts
} }
const scriptPattern = /<script[^>]*?src="([^"]*?)" defer><\/script>/g const scriptPattern = /<script[^>]*?src="([^"]*?)" defer><\/script>/g
@ -57,7 +57,7 @@ export default class ModernRenderer extends SSRRenderer {
const legacyJsFile = jsFile.replace(this.publicPath, '') const legacyJsFile = jsFile.replace(this.publicPath, '')
const modernJsFile = this.assetsMapping[legacyJsFile] const modernJsFile = this.assetsMapping[legacyJsFile]
if (!modernJsFile) { if (!modernJsFile) {
return scriptTag return scriptTag.replace('<script', `<script nomodule`)
} }
const moduleTag = scriptTag const moduleTag = scriptTag
.replace('<script', `<script type="module"`) .replace('<script', `<script type="module"`)