-
Hi!
I ran it using I then built and ran app on my phone using Something was wrong. I tried to debug the script, and found out that script execution stops on the I started researching about how to use packages in the code, import them and etc. and found myself very confused. I learned that there is a difference between running the script on the web-page and using Could someone please give me some advice or tips to move in the right direction? I would be really happy |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Cordova runs in a webview, which is comparable to a browser. Node, while runs in a JS engine like the browser, is a very different environment with different APIs (e.g. there is no It is possible to pull node packages and bundle them for the browser, but Cordova doesn't do this. In fact Cordova is unopinionated, you provide your built JS files and cordova will include them in the app binary. The only requirement is the JS should be able to run in a browser environment. Therefore to include node modules, you'll need to use a bundler tool such as Webpack, Browserify, or Rollup to name a few. However even if you use those tools, the module must be written to support a browser environment. I'm not familiar with the If OpenAI framework has native libraries for android, it might be better to create a cordova plugin that includes the android native library for your project, and the cordova plugin serves to provide a JS interface to the native library. |
Beta Was this translation helpful? Give feedback.
Cordova runs in a webview, which is comparable to a browser.
Node, while runs in a JS engine like the browser, is a very different environment with different APIs (e.g. there is no
require
in the browser as that is a Node module concept)It is possible to pull node packages and bundle them for the browser, but Cordova doesn't do this. In fact Cordova is unopinionated, you provide your built JS files and cordova will include them in the app binary. The only requirement is the JS should be able to run in a browser environment. Therefore to include node modules, you'll need to use a bundler tool such as Webpack, Browserify, or Rollup to name a few.
However even if you use those tools, the mo…