I am using Capacitor without Ionic on a React project.
My capacitor.config.ts
file is set as below :
import { CapacitorConfig } from '@capacitor/cli';
let config: CapacitorConfig;
const baseConfig: CapacitorConfig = {
appId: 'com.myAPp',
appName: 'myApp',
webDir: 'build',
bundledWebRuntime: false,
};
switch (process.env.NODE_ENV) {
case 'production':
config = {
...baseConfig,
loggingBehavior: 'none',
};
break;
default:
config = {
...baseConfig,
"server": {
"url": "http://192.168.11.2:3000",
"cleartext": true
},
};
break;
}
export default config;
I build my application by running react-scripts build
then NODE_ENV=production npx cap run ios
.
Even if the loggingBehavior is set to “none” which according to the documentation should not produce any console.error/console.debug, i’m still able to see logs on the console.
<button
onClick={() => {
console.debug("Hello world");
}}
>
Console.debug
</button>