How to set dynamic value of the appId and appName inside the capacitor.config.ts

How can i set the dynamic value of the appId and appName inside the capacitor.config.ts.
I am trying to do like below…

import { CapacitorConfig } from "@capacitor/cli";
// import { app } from "./src/environments/environment";
import { AppConfig } from "./src/appconfig";
// import { appId, appName } from "./src/app/app.module";

const config: CapacitorConfig = {
    appId: new AppConfig().appId,
    appName: new AppConfig().appName,
    bundledWebRuntime: false,
    webDir: "www",
    plugins: {
      SplashScreen: {
        launchShowDuration: 0
    cordova: {}
  export default config;

Can anyone suggest me, How can do this?


You can set there whatever you want, but this will not cause updating the native Projects.

I have a similiar usecase (white label app) where i create myself a own script that directly changes the native files

@EinfachHans Thanks for the info,

I am getting error using my above code that i have mentioned

Can you suggest me about the script that you had written to change the native file.

So you are trying to add a new Platform? What does new AppConfig() do?

Yes, I want to add new appId and appName based on the different-2 environment


That won’t work. I can’t share my Scripts as they have very much company based stuff in it, but basically you change the native files for ios and android to adjust your appname appid version and whatever you want

No Problem
I will try to make as you suggested