Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store Devtools: Missing environment files with Angular 15 #3618

Closed
1 of 2 tasks
fmalcher opened this issue Oct 19, 2022 · 1 comment · Fixed by #3645
Closed
1 of 2 tasks

Store Devtools: Missing environment files with Angular 15 #3618

fmalcher opened this issue Oct 19, 2022 · 1 comment · Fixed by #3645

Comments

@fmalcher
Copy link
Contributor

fmalcher commented Oct 19, 2022

Which @ngrx/* package(s) are the source of the bug?

store-devtools

Minimal reproduction of the bug/regression with instructions

As of Angular 15.0.0 the environments folder and the related fileReplacements will not be configured in new projects anymore. However, the schematics for store-devtools generate code that relies on the production flag.

The ng-add schematics for store-devtools have to be aligned accordingly.
What would the desired way look like?

Minimal reproduction of the bug/regression with instructions

create an Angular project with v15

npm i @ngrx/store-devtools --force
ng g @ngrx/store-devtools:ng-add

In src/app/app.module.ts, an import will be added for ../environments/environment which does not exist.

Versions of NgRx, Angular, Node, affected browser(s) and operating system(s)

  • Angular 15.0.0-next.6
  • NgRx 14.3.2

Other information

No response

I would be willing to submit a PR to fix this issue

  • Yes
  • No
@fmalcher
Copy link
Contributor Author

fmalcher commented Oct 25, 2022

The Angular PWA features use isDevMode() to enable the service worker config:

 ServiceWorkerModule.register('ngsw-worker.js', {
      enabled: !isDevMode(),
      // Register the ServiceWorker as soon as the application is stable
      // or after 30 seconds (whichever comes first).
      registrationStrategy: 'registerWhenStable:30000'
    })

So for a quick fix without rethinking everything I'd suggest using isDevMode!

brandonroberts pushed a commit that referenced this issue Nov 5, 2022
Closes #3618

As of Angular 15.0.0 there will be no auto-generated environment files
anymore for new apps. Instead, we use the builtin `isDevMode()`
function from Angular.

- store-devtools: ng-add (logOnly option)
- store: ng-add
- schematics: store, reducer
- update documentation and examples
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants