import { Network } from '@capacitor/network';
Network.addListener('networkStatusChange', status => {
console.log('Network status changed', status);
});
const logCurrentNetworkStatus = async () => {
const status = await Network.getStatus();
console.log('Network status:', status);
};
Uncaught TypeError: Failed to resolve module specifier "@capacitor/network". Relative references must start with either "/", "./", or "../".
So I went to the forum and:
If you don’t want to use a bundler/framework, you can set "bundledWebRuntime": true in capacitor.config.json .
That generates a capacitor.js file you can link in your app’s index.html.
That way you can use Capacitor object directly, which includes a Plugins object that contains all plugins.
So you can use the plugins like Capacitor.Plugins.StatusBar.hide();
But:
<script src="capacitor.js"></script>
capacitor.js net::ERR_ABORTED 404 (Wappler: Not Found)
Because indeed, there’s no capacitor.js on the Wappler project.
For what platform are you having troubles with Capacitor?
What troubles and errors do you get exactly? Have you tried to run in the emulator?
In general there is no need for tools like webpack or other bundles in the mobile apps in Wappler when you use the supplied plugins.
We are actually using the option bundledWebRuntime just for that to indicate we don’t use any bundlers. So it should work all fine without any and it is not a problem that the option is deprecated.
There’s no chance I can get a simple getStatus() working.
I’m just wan’t to know, if I’m missing something. I got all working on an old cordova project.
I know there are many others (natives and from third party) that I assume the community will be pleased to have.
Don’t know why I get too difficult to implement on this capacitor version. I was able to manage it with no problems in the past.
Also, consider that the integrated camera plugin doesn’t work anymore on capacitor 5.3.0 (Please someone confirm this)
We have the most core plugins already ready for release and will be releasing extensibility guide so you can package and install other capacitor plugins and build your own integration in app connect so that they natively integrate with app connect data and events.
bundledWebRuntime?: boolean;
/**
* Whether to copy the Capacitor runtime bundle or not.
*
* If your app is not using a bundler, set this to `true`, then Capacitor
* will create a `capacitor.js` file that you'll need to add as a script in
* your `index.html` file.
*
* It's deprecated and will be removed in Capacitor 6
*
* @since 1.0.0
* @deprecated 5.0.0
* @default false
*/
That was an attemp and for some reason was not working.
But, after trying everything (I have like 30 different projects) I found if I change the dmxAppConnect.js from stable to beta, (manually cause I can’t use the updater on beta 8, already reported) the console error dissapear.
it’s working as expected!!!
Thanks @patrick, and of course all the team.
You can’t imagine how grateful I am