Skip to content

Commit ada5f26

Browse files
marcindz88rainerhahnekamp
authored andcommitted
feat: withDevTools disabled in prod, and tree-shaking docs - docs utility function update
1 parent 4c2baa9 commit ada5f26

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

README.md

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,9 @@ updateState(this.store, 'update loading', { loading: false });
9494

9595
<summary>Devtools tree-shaking details</summary>
9696

97-
environment.ts:
97+
It is required to add the `withDevtools` function to the environment files.
98+
99+
environments/environment.ts:
98100
```typescript
99101
import { withDevtools } from '@angular-architects/ngrx-toolkit';
100102

@@ -103,7 +105,7 @@ export const environment = {
103105
}
104106
```
105107

106-
environment.prod.ts
108+
environments/environment.prod.ts
107109
```typescript
108110
import { withDevtoolsStub } from '@angular-architects/ngrx-toolkit';
109111

@@ -112,12 +114,21 @@ export const environment = {
112114
}
113115
```
114116

115-
Then all you need to do is replace `withDevTools` everywhere in your app with `environment.storeWithDevTools`
117+
Then you can create utility function which can be used across the application
116118
e.g.:
119+
120+
shared/store.features.ts (or any other file)
121+
```typescript
122+
import { environment } from 'src/environments/environment';
123+
124+
export const withTreeShakableDevTools = environment.storeWithDevTools;
125+
```
126+
127+
And use it in your store definitions:
117128
```typescript
118129
export const SomeStore = signalStore(
119130
withState({strings: [] as string[] }),
120-
environment.storeWithDevTools('featureName')
131+
withTreeShakableDevTools('featureName')
121132
);
122133
```
123134

0 commit comments

Comments
 (0)