Skip to content

MagicString is not a constructor #33743

Description

@sysmat

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

compiler

Is this a regression?

Yes

Description

when building lib "type": "module" with "vite": "^8.2.0" and using it in angualar lib, I get error

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

> ng build my-lib

Building Angular Package

------------------------------------------------------------------------------
Building entry point 'my-lib'
------------------------------------------------------------------------------
✔ Compiling with Angular sources in partial compilation mode.
✖ 
MagicString is not a constructor

Please provide the environment you discovered this bug in (run ng version)

Angular CLI       : 22.1.2
Node.js           : 24.18.0
Package Manager   : npm 11.16.0
Operating System  : win32 x64

Anything else?

npm ls magic-string

├─┬ @angular/build@22.1.2
│ └── magic-string@1.0.0
├─┬ @angular/cli@22.1.2
│ └─┬ @angular-devkit/schematics@22.1.2
│   └── magic-string@1.0.0 deduped
└─┬ ng-packagr@22.1.0
  └─┬ rollup-plugin-dts@6.5.0
    └── magic-string@1.1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions