Skip to content

Commit d16e25e

Browse files
rennayRachel Lee Nabors
authored andcommitted
Update setup.mdx (#5287)
* Update setup.mdx Hi - Update made for Angular 15 support. src/polyfill.ts does not exist. Aligning this documentation with Amplify docs - https://ui.docs.amplify.aws/angular/getting-started/troubleshooting. Regards, Rennay * Update using BlockSwitcher Hi - As per suggestion from @tannerabread, I have made the update using BlockSwitcher. Apologies in advance if not completed correctly. I could not confirm using Preview. Please let me know if any further update required. Again, aligning to https://ui.docs.amplify.aws/angular/getting-started/troubleshooting. Regards, Rennay
1 parent 2241538 commit d16e25e

File tree

1 file changed

+43
-3
lines changed
  • src/fragments/start/getting-started/angular

1 file changed

+43
-3
lines changed

src/fragments/start/getting-started/angular/setup.mdx

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,56 @@ npx -p @angular/cli ng new amplify-app
99
cd amplify-app
1010
```
1111

12-
### Angular 6+ Support
12+
Angular 6+ does not include shims for 'global' or 'process'.
1313

14-
Angular 6+ does not include shims for 'global' or 'process' as provided in previous versions. Add the following to your `src/polyfills.ts` file to recreate them:
14+
<BlockSwitcher>
15+
16+
<Block name="Angular 15">
17+
18+
First, create `src/polyfills.ts` and add the following:
1519

1620
```javascript
1721
(window as any).global = window;
1822
(window as any).process = {
1923
env: { DEBUG: undefined },
2024
};
21-
```
25+
```
26+
27+
Then, open your `angular.json` file, and add `src/polyfills.ts` to polyfills array(s) in your `angular.json`. These arrays are located in projects.`<project-name>.architect.<task-name>.options`.
28+
29+
```javascript
30+
"polyfills": [
31+
"zone.js",
32+
"src/polyfills.ts"
33+
],
34+
```
35+
36+
And finally, make sure to add `src/polyfills` to files in your `tsconfig.app.json`:
37+
38+
```javascript
39+
{
40+
"files": [
41+
"src/main.ts",
42+
"src/polyfills.ts"
43+
],
44+
}
45+
```
46+
</Block>
47+
48+
<Block name="Angular 6-14">
49+
50+
Add the following to your `src/polyfills.ts` file to recreate them:
51+
52+
```javascript
53+
(window as any).global = window;
54+
(window as any).process = {
55+
env: { DEBUG: undefined },
56+
};
57+
```
58+
59+
</Block>
60+
61+
</BlockSwitcher>
2262

2363
## Create a new Amplify backend
2464

0 commit comments

Comments
 (0)