No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    spa + capacitor || dynamic import capacitor plugins

    Help
    2
    3
    367
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • R
      rabix last edited by rabix

      Please tell me how to import plugins for the capacitor, if everything crashes when launched in SPA mode.
      I check for the platform or mod, but still an error comes out, although the import is dynamic.

      I have this error only in SPA mode, in capacitor all fine.

      image_2020-10-01_18-59-06.png

      metalsadman 1 Reply Last reply Reply Quote 0
      • metalsadman
        metalsadman @rabix last edited by metalsadman

        @rabix try

        async created () {
          let apiPush = null
          if (process.env.MODE === 'capacitor') {
            apiPush = await import('my-fancy-npm-package') // .then(package => package.default)
          }
        }
        

        https://quasar.dev/quasar-cli/handling-process-env#Import-based-on-process.env

        R 1 Reply Last reply Reply Quote 0
        • R
          rabix @metalsadman last edited by

          @metalsadman thanks!!!

          1 Reply Last reply Reply Quote 0
          • First post
            Last post