Skip to content
Permalink
Browse files

fix: undefined script in modern mode

  • Loading branch information...
clarkdo committed Jan 10, 2019
1 parent e8083fb commit 0a21d4b34ca2f3bde2a54452f3d6831a0b1ee362
Showing with 8 additions and 1 deletion.
  1. +8 −1 packages/vue-renderer/src/renderer.js
@@ -59,7 +59,11 @@ export default class VueRenderer {
const modernJsFile = this.assetsMapping[legacyJsFile]
const crossorigin = this.context.options.build.crossorigin
const cors = `${crossorigin ? ` crossorigin="${crossorigin}"` : ''}`
const moduleTag = scriptTag.replace('<script', `<script type="module"${cors}`).replace(legacyJsFile, modernJsFile)
const moduleTag = modernJsFile
? scriptTag
.replace('<script', `<script type="module"${cors}`)
.replace(legacyJsFile, modernJsFile)
: ''
const noModuleTag = scriptTag.replace('<script', `<script nomodule${cors}`)
return noModuleTag + moduleTag
})
@@ -95,6 +99,9 @@ export default class VueRenderer {
return context.renderResourceHints().replace(linkPattern, (linkTag, jsFile) => {
const legacyJsFile = jsFile.replace(publicPath, '')
const modernJsFile = this.assetsMapping[legacyJsFile]
if (!modernJsFile) {
return ''
}
const crossorigin = this.context.options.build.crossorigin
const cors = `${crossorigin ? ` crossorigin="${crossorigin}"` : ''}`
return linkTag.replace('rel="preload"', `rel="modulepreload"${cors}`).replace(legacyJsFile, modernJsFile)

0 comments on commit 0a21d4b

Please sign in to comment.
You can’t perform that action at this time.