Quasar based WordPress plugin running into snags

  • I’m trying to use a quasar project as a wordpress plugin and I’m having some trouble.

    I have it built and put in a plugin subdirectory, the assets seem to load from my registered plugin. But then I see this error thrown in the console.

    Uncaught TypeError: Cannot read property 'classList' of null
        at body.js:49
        at _ (body.js:83)
        at Object.install (install.js:27)
        at Function.t.use (vue.runtime.esm.js:5101)
        at Module.2f39 (import-quasar.js:19)
        at i (bootstrap:89)
        at Object.0 (app.6d594680.js?ver=0.1:1)
        at i (bootstrap:89)
        at r (bootstrap:45)
        at Array.t [as push] (bootstrap:32)

    The first line in question is: document.body.classList.add.apply(document.body.classList, cls) , where document.body appear to be undefined.

    This is using

    Build mode........ spa
    Pkg quasar........ v1.0.0-rc.3
    Pkg @quasar/app... v1.0.0-rc.4
    Debugging......... enabled

    I’m afraid that I’m a little out of my depth in trying to figure this one out, it seems like something is missing or is getting run out of order. But all the assets seem to load fine and in the order I put them in there. I don’t really understand the innards here.

    I really don’t want to yank quasar and run vanilla vue to get this project out the door, so I’m looking for a solution or potentially documentation that may help me.

  • Solved my own issue. This occurs when I put the <script> load tags before the intended injection <div>. Move them to the footer and it works.

Log in to reply