'undefined' error due to missing Platform plugin when using Popover



  • Hello!
    I’m trying to use a QPopover as in the docs (i.e. the <q-popover> is a direct descendant of <q-btn>), but when I click the button, I get this error:
    TypeError: __WEBPACK_IMPORTED_MODULE_0__plugins_platform__.a.is is undefined

    edit: above error in Firefox, Chrome provides the much more descriptive Uncaught TypeError: Cannot read property 'desktop' of undefined.

    I’ve tracked it down to the file escape-key.js, which checks the Platform object; which my debugger confirms is indeed undefined:

    0_1528900204767_scrnsht.png

    The QPopover is correctly included in components in quasar.conf.js, as well as Platform in plugins, and I am not sure what else could be the cause of this error.

    Thanks in advance!



  • @tmladek what about if you try importing like this ?

    import { Platform } from 'quasar'
    

    It’s working for me in a state.js file:

    import { Platform } from 'quasar'
    
    export default {
      platform: Platform
    }
    

  • Admin

    The scenario described here is impossible… Plugin platform is always installed. Can I take a look on a reproduction repo pls?
    Might be that uglifyjs messes things up. What Quasar version are you using? Does it happen on dev mode?



  • Hello again! I’m afraid that this issue might have solved itself.

    I realized I accidentally lied about the <q-popover> being a direct child of <q-btn>, because it was in a different component (of which the QPopover was the root element). Changing this and putting the <q-popover> directly in the parent component solved the issue, so I thought this was the problem; but when I reverted back to it being separate, it actually still works and I can’t reproduce the error.