Skip to content

Commit

Permalink
refactor(store): tree-shake development options token (#2260)
Browse files Browse the repository at this point in the history
Adds `__PURE__` annotation to the `NGXS_DEVELOPMENT_OPTIONS` to drop the code when it's
unused in production.
  • Loading branch information
arturovt authored Nov 18, 2024
1 parent e14b71b commit a6757af
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ $ npm install @ngxs/store@dev

### To become next patch version

- Refactor: Allow tree-shaking of dev-only code [#2259](https://github.com/ngxs/store/pull/2259)
- Refactor: Use field initializers for injectees [#2258](https://github.com/ngxs/store/pull/2258)
- Refactor: Allow tree-shaking of dev-only code [#2259](https://github.com/ngxs/store/pull/2259)
- Fix(store): Run plugins in injection context [#2256](https://github.com/ngxs/store/pull/2256)
- Fix(websocket-plugin): Do not dispatch action when root injector is destroyed [#2257](https://github.com/ngxs/store/pull/2257)
- Refactor(store): Tree-shake development options token [#2260](https://github.com/ngxs/store/pull/2260)

### 18.1.5 2024-11-12

Expand Down
15 changes: 8 additions & 7 deletions packages/store/src/dev-features/symbols.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ export interface NgxsDevelopmentOptions {
};
}

export const NGXS_DEVELOPMENT_OPTIONS = new InjectionToken<NgxsDevelopmentOptions>(
typeof ngDevMode !== 'undefined' && ngDevMode ? 'NGXS_DEVELOPMENT_OPTIONS' : '',
{
providedIn: 'root',
factory: () => ({ warnOnUnhandledActions: true })
}
);
export const NGXS_DEVELOPMENT_OPTIONS =
/* @__PURE__ */ new InjectionToken<NgxsDevelopmentOptions>(
typeof ngDevMode !== 'undefined' && ngDevMode ? 'NGXS_DEVELOPMENT_OPTIONS' : '',
{
providedIn: 'root',
factory: () => ({ warnOnUnhandledActions: true })
}
);

0 comments on commit a6757af

Please sign in to comment.