Skip to content

Commit 256dfcb

Browse files
committed
Angular 20 update.
1 parent 843b208 commit 256dfcb

File tree

10 files changed

+2276
-4394
lines changed

10 files changed

+2276
-4394
lines changed

.github/pull_request_template.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
### Description
2+
3+
A brief overview of your completed or ongoing work.
4+
5+
### Developement Checklist
6+
7+
- [ ] Bump version up (`package.json` **and** `package-lock.json`)
8+
9+
### Preview(s)
10+
11+
- Add screenshots, gifs, videos, etc. here for a quick preview if applicable.

README.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -152,16 +152,17 @@ Customization with optional inputs and icon
152152

153153
## Compatibility <a name="compatibility"></a>
154154

155-
| Angular version | @proangular/ngx-scroll-top | Status |
156-
| --------------- | -------------------------- | ---------- |
157-
| v19 | v19.0.0 | Compatible |
158-
| v18 | ------ | Untested |
159-
| v17 | ------ | Untested |
160-
| v16 | ------ | Untested |
161-
| v15 | ------ | Untested |
162-
| v14 | v1.x.x | Compatible |
163-
| v13 | v1.x.x | Compatible |
164-
| v12 | v1.x.x | Compatible |
155+
| Angular version | @proangular/ngx-scroll-top | Install |
156+
| --------------- | -------------------------- | ------------------------------------------- |
157+
| v20 | v20.0.0 | `ng add @proangular/ngx-scroll-top@^20.0.0` |
158+
| v19 | v19.0.0 | `ng add @proangular/ngx-scroll-top@^19.0.0` |
159+
| v18 | ------ | Untested |
160+
| v17 | ------ | Untested |
161+
| v16 | ------ | Untested |
162+
| v15 | ------ | Untested |
163+
| v14 | v1.x.x | `ng add @proangular/ngx-scroll-top@1.1.8` |
164+
| v13 | v1.x.x | `ng add @proangular/ngx-scroll-top@1.1.8` |
165+
| v12 | v1.x.x | `ng add @proangular/ngx-scroll-top@1.1.8` |
165166

166167
<p align="right">[ <a href="#index">Index</a> ]</p>
167168

SUGGESTIONS.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Suggestions for fixing missing `zone.js` error
2+
3+
When running `npm run start` with the original project you might see an error like this:
4+
5+
```text
6+
Failed to resolve import "zone.js" from ".angular/vite-root/ngx-scroll-top/polyfills.js". Does the file exist?
7+
```
8+
9+
Angular 20 no longer adds **Zone.js** by default; however this project still attempted to load it via the `polyfills` array in `angular.json`. When the dependency is not installed this leads to the above Vite error. There are two ways to resolve this:
10+
11+
## ✅ Recommended: Enable zoneless change detection
12+
13+
Angular 20 provides an official **zoneless** mode which removes the need for `zone.js`. It improves bundle size and performance and avoids issues when `zone.js` isn’t available. To enable this in the project:
14+
15+
1. **Remove `zone.js` from the build and test polyfills**. In `angular.json` the `polyfills` arrays were cleared for the `build` and `test` targets.
16+
2. **Switch to the zoneless provider**. In `src/app/app.config.ts` replace `provideZoneChangeDetection({ eventCoalescing: true })` with `provideZonelessChangeDetection()`. This tells Angular to schedule change detection only after supported notifications such as host/template events, signal updates and `AsyncPipe` emissions.
17+
3. **Update tests**. The spec file now calls `provideZonelessChangeDetection()` when configuring the `TestBed` so tests run in the same mode as production.
18+
19+
With these changes the project builds and runs without attempting to import `zone.js`.
20+
21+
## 🔧 Alternative: Install `zone.js`
22+
23+
If you don’t want to migrate to zoneless change detection you can simply install the missing dependency:
24+
25+
```bash
26+
npm install zone.js --save
27+
```
28+
29+
After installation you should keep `"zone.js"` in the `polyfills` array and continue using `provideZoneChangeDetection`. However, note that the container environment used here does not have network access to fetch packages from npm, so the zoneless approach was used instead.
30+
31+
## Files updated
32+
33+
The following files were changed to implement the zoneless fix:
34+
35+
- **angular.json** – removed `zone.js` and `zone.js/testing` from the `polyfills` arrays.
36+
- **src/app/app.config.ts** – replaced `provideZoneChangeDetection` with `provideZonelessChangeDetection()`.
37+
- **src/app/app.component.spec.ts** – added a provider for `provideZonelessChangeDetection()` to align tests with the production configuration.
38+
39+
A copy of the updated project (including this file) has been provided in the zip archive.

0 commit comments

Comments
 (0)