Monaca Onsen UI Discord Chat Github Repo

Imported from pgb and now not a single plugin works



  • Hello!

    I’m having a hard time trying to run my imported app. I’ve built it using the custom debugger to include onesignal-cordova-plugin and cordova-plugin-x-toast, but it always returns <<Uncaught TypeError: Cannot read property ‘OneSignal’ of undefined>>
    The same error occurs with x-toast. These plugins are being called as I always did in pgb, I don’t know If I’m missing something to ‘translate’ my project to Monaca.

    Here’s my package.json:

    {
      "name": "monaca-template-minimum",
      "version": "2.1.0",
      "displayName": "Monaca Template Minimum",
      "dependencies": {
        "cordova-android": "^8.1.0",
        "cordova-custom-config": "5.1.0",
        "cordova-plugin-compat": "^1.2.0",
        "cordova-plugin-splashscreen": "5.0.2",
        "cordova-plugin-whitelist": "1.3.3",
        "es6-promise-plugin": "^4.1.0",
        "monaca-plugin-monaca-core": "3.3.0",
        "onesignal-cordova-plugin": "^2.11.1"
      },
      "scripts": {
        "monaca:preview": "npm run dev",
        "dev": "browser-sync start -s www/ --watch --port 8080 --ui-port 8081"
      },
      "cordova": {
        "plugins": {
          "cordova-plugin-whitelist": {},
          "cordova-plugin-splashscreen": {},
          "cordova-custom-config": {},
          "monaca-plugin-monaca-core": {},
          "cordova-plugin-calendar": {},
          "cordova-plugin-listpicker": {},
          "cordova-plugin-datepicker": {},
          "cordova-plugin-x-socialsharing": {},
          "cordova-plugin-x-toast": {},
          "cordova-plugin-device": {},
          "cordova-plugin-globalization": {},
          "cordova-plugin-network-information": {},
          "cordova-plugin-inappbrowser": {},
          "onesignal-cordova-plugin": {}
        },
        "platforms": [
          "android"
        ]
      },
      "devDependencies": {
        "browser-sync": "^2.26.7",
        "cordova": "^9.0.0",
        "cordova-plugin-calendar": "^4.5.0",
        "cordova-plugin-datepicker": "^0.9.3",
        "cordova-plugin-device": "^1.1.7",
        "cordova-plugin-globalization": "^1.0.8",
        "cordova-plugin-inappbrowser": "^1.6.1",
        "cordova-plugin-listpicker": "^2.2.2",
        "cordova-plugin-network-information": "^1.3.4",
        "cordova-plugin-x-socialsharing": "^5.2.1",
        "cordova-plugin-x-toast": "^2.6.0"
      }
    }
    

    (They are also in my config.xml file)

    And here’s how I call the plugins from within my html

    window.plugins.toast.showLongBottom(translator.getStr('error_connexio'));
    

    or

    window.plugins.OneSignal.getIds(function(ids) {
    }
    

    I even installed every plugin with
    cordova plugin add
    cordova platform add android
    cordova prepare

    Thank you in advance.