Open rehanbabertkxel opened 4 years ago
The project-config is tied to the frontend project type and not to each env, so yes, you need to change it when you have different build command for different env.
Another option than creating a new branch would be to write a script for the build command, and in the script it first checks the env (information available as envName
in amplify/.config/local-env-info
, and invoke the different ng build
configuration accordingly.
@UnleashedMind , do you have any plans of considering multiple front end environment during "amplify publish". If there can be a way to tell in the project-config.json to use front end environment according to the checkout amplify environment?
I'm marking this as a feature request then, will talk to the team and see if we can add this feature. will keep you posted.
@UnleashedMind , yeah that would be quite helpful for teams working with different front end environemnt.
I'm utilizing Amplify strictly for publishing my frontend React app, and I'm running into the same issue. I can't figure out how to have configure two different stages prod
and dev
, and deploy them separately, do different URLs
for amplify publish
and angular.
it's defaulting to ng build --prod
. We don't have the option to substitute this with something else like ng build -c development
. I can't find any documentation on how to extend amplify publish other than this:
Hi all,
I had the same issue here this morning, and also found a stackoverflow question asking the same question which i answered with our teams current solution. Hopefully this helps someone whilst the amplify team work on a first party solution:
Hey folks in the thread :wave: as a workaround, we can potentially leverage an environment variable and point our build script to reference this environment variable (i.e. ng build --configuration $MY_AMPLIFY_ENVIRONMENT
)
Which Category is your question related to? Multi Environment Deployments
Amplify CLI Version 4.13.1
Provide additional details e.g. code snippets I am using different environment in my Font End Angular8 app and to build it in different environments, we have multiple commands like:
"build": "ng build --prod --configuration=dev", "build-test": "ng build --prod --configuration=test",
But when I run amplify publish, the Build command in project-config.json is:
npm run-script build
so this will only run with the dev configuration.
What is the best way to run it with the"test" configuration other than creating a new branch and changing the BuildCommand in that branch.