ENV vars in config #5204
-
Is there a way to actually use env variables in the capacitor.config.ts file? Every time I boot up xcode, the app will not launch and gives me the I am using the following: const config: CapacitorConfig = {
// ... rest of config removed for clarity
server: {
url: `${process.env.REACT_APP_SITE_URL}`,
}
} |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
Hi. You could create a script that replaces the environment variable with its value with "fs" script.js
Not the best solution but I think it should work
|
Beta Was this translation helpful? Give feedback.
-
If you are using the last version of the capacitor and typescript here is an example that is really easy to follow that worked for me.
|
Beta Was this translation helpful? Give feedback.
-
I came here, becaue
partial npm scripts in "cap:sync:debug": "cross-env NODE_ENV=development cap sync",
"cap:sync:release": "cross-env NODE_ENV=production cap sync" |
Beta Was this translation helpful? Give feedback.
Hi. You could create a script that replaces the environment variable with its value with "fs"
script.js