Skip to content

new Worker() doesn't work from a library #29228

Closed as not planned
Closed as not planned
@mr-dev-dragon

Description

@mr-dev-dragon

Command

generate

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

Angular CLI: 19.0.6 | Angular Core: 19.0.5 | Node.js: 20.13.1

Description

The issue describes a problem when attempting to use the new Worker() constructor within an Angular library. The expected behavior is that the Web Worker should function correctly when instantiated from a library. However, it appears that this is not the case, indicating a potential bug in the Angular CLI's handling of Web Workers within libraries.

Minimal Reproduction

empty Brean new project

action =>
ng g component profile --standalone :

          CREATE src/app/profile/profile.component.html (23 bytes)
          CREATE src/app/profile/profile.component.spec.ts (622 bytes)
          CREATE src/app/profile/profile.component.ts (230 bytes)     
          CREATE src/app/profile/profile.component.scss (0 bytes)   

result = >

           import { Component } from '@angular/core';
            
            @Component({
              selector: 'app-profile',
              imports: [],
              templateUrl: './profile.component.html',
              styleUrl: './profile.component.scss'
            })
            export class ProfileComponent {
            
            }

I event added schematics to anguler.json =>

           "schematics": {
                "@schematics/angular:component": {
                  "style": "scss",
                  "standalone": true
                }
              },             

Exception or Error

no notifaction

Your Environment

ng version =>

                    Angular CLI: 19.0.6
                    Node: 20.13.1
                    Package Manager: npm 10.9.1
                    OS: win32 x64
                    
                    Angular: 19.0.5
                    Package                         Version
                    ---------------------------------------------------------  
                    @angular-devkit/architect       0.1900.6
                    @angular-devkit/build-angular   19.0.6
                    @angular-devkit/core            19.0.6
                    @angular-devkit/schematics      19.0.6
                    @angular/cli                    19.0.6
                    @schematics/angular             19.0.6
                    rxjs                            7.8.1
                    typescript                      5.6.3
                    zone.js                         0.15.0

Anything else relevant?

no

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions