Skip to content

Commit

Permalink
feat(app-webpack): workaround vue/devtools issue when used with webpack
Browse files Browse the repository at this point in the history
  • Loading branch information
rstoenescu committed Jul 31, 2023
1 parent 9399f0a commit 543dd9e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
22 changes: 15 additions & 7 deletions app-webpack/lib/webpack/plugin.html-addons.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ function makeTag (tagName, attributes, closeTag = false) {
}
}

// function makeScriptTag (innerHTML) {
// return {
// tagName: 'script',
// closeTag: true,
// innerHTML
// }
// }
function makeScriptTag (innerHTML) {
return {
tagName: 'script',
closeTag: true,
innerHTML
}
}

function fillBaseTag (html, base) {
return html.replace(
Expand All @@ -39,6 +39,14 @@ module.exports.HtmlAddonsPlugin = class HtmlAddonsPlugin {
data.html = fillBaseTag(data.html, this.cfg.build.appBase)
}

if (this.cfg.metaConf.vueDevtools !== false) {
const { host, port } = this.cfg.metaConf.vueDevtools
data.headTags.push(
makeScriptTag(`window.__VUE_DEVTOOLS_HOST__ = '${ host }';window.__VUE_DEVTOOLS_PORT__ = '${ port }';`),
makeTag('script', { src: `http://${ host }:${ port }` }, true)
)
}

if (this.cfg.ctx.mode.cordova) {
data.bodyTags.unshift(
makeTag('script', { src: 'cordova.js' }, true)
Expand Down
8 changes: 0 additions & 8 deletions app-webpack/templates/entry/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@
<% } %>
<% } %>

<% if (metaConf.vueDevtools !== false) { %>
import vueDevtools from '@vue/devtools'
<% } %>

import { Quasar } from 'quasar'
import { markRaw } from 'vue'
import <%= metaConf.needsAppMountHook === true ? 'AppComponent' : 'RootComponent' %> from 'app/<%= sourceFiles.rootComponent %>'
Expand All @@ -47,10 +43,6 @@ const RootComponent = defineComponent({
SplashScreen.hide()
<% } %>

<% if (metaConf.vueDevtools !== false) { %>
vueDevtools.connect('<%= metaConf.vueDevtools.host %>', <%= metaConf.vueDevtools.port %>)
<% } %>

<% if (ctx.mode.ssr && ssr.manualPostHydrationTrigger !== true) { %>
const { proxy: { $q } } = getCurrentInstance()
$q.onSSRHydrated !== void 0 && $q.onSSRHydrated()
Expand Down

0 comments on commit 543dd9e

Please sign in to comment.