hampoelz / Capacitor-NodeJS

📱 A full-fledged Node.js runtime for Capacitor apps.
MIT License
77 stars 16 forks source link

How do I use this plugin in Quasar's capacitor. #22

Closed 2061360308 closed 11 months ago

2061360308 commented 11 months ago

my project like this: 图片

quasar hava a “\src-capacitor\capacitor.config.json“ and I configure it in this file

{
  "appId": "cn.test",
  "appName": "Quasar App",
  "webDir": "www",
  "server": {
    "androidScheme": "https",
    "url": "http://192.168.1.9:9500"
  },
  "plugins": {
    "CapacitorNodeJS": {
      "nodeDir": "nodejs"
    }
  }
}

I have created the nodejs folder in the ' src capacitor' and root directory,like: 图片 Finally, I imported and used an example of the plugin in “indexPage. vue” 图片

The results I obtained show that the plugin did not import properly 图片

quasar docs:https://quasar.dev/docs

hampoelz commented 11 months ago

I've never used quasar before, but as long as the plugin is not recognized at all, I don't think I can do much about it.

Could you try adding another Capacitor plugin to your project and check if this plugin is recognized? If other Capacitor plugins are also not properly recognized, the problem may be with quasar.

2061360308 commented 11 months ago

I've never used quasar before, but as long as the plugin is not recognized at all, I don't think I can do much about it.

Could you try adding another Capacitor plugin to your project and check if this plugin is recognized? If other Capacitor plugins are also not properly recognized, the problem may be with quasar.

Thank you for your answer. This plugin is available when I create a new project using capacitor, and I will seek help from the quasar community.

2061360308 commented 11 months ago

I successfully solved this problem.

  1. First, create nodejs in the “/src-capacitor/www”.
  2. Secondly I run the "npm install https://github.com/hampoelz/capacitor-nodejs/releases/download/v1.0.0-beta.6/capacitor-nodejs.tgz" command in the "src-capacitor" directory.
  3. Then use "npx cap sync"。

This way, it can be used normally。

But there is a problem that when you use the quasar command to build, the www directory will be overwritten, and every time you update the nodejs directory, you need to manually run "npx cap sync".At present, I haven't found a better way