Skip to content

Cannot optimize dependency: @pkg-name/package.json, present in client 'optimizeDeps.include' #33280

@Badisi

Description

@Badisi

Command

serve

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

v19

Description

Trying to serve an angular application that has the following imports:

import authJsPkgJson from '@badisi/auth-js/package.json' with { type: 'json' };
import authVuePkgJson from '@badisi/auth-vue/package.json' with { type: 'json' };
import ngxAuthPkgJson from '@badisi/ngx-auth/package.json' with { type: 'json' };

will result in the following errors:

Cannot optimize dependency: @badisi/auth-js/package.json, present in client 'optimizeDeps.include'
Cannot optimize dependency: @badisi/auth-vue/package.json, present in client 'optimizeDeps.include'
Cannot optimize dependency: badisi/ngx-auth/package.json, present in client 'optimizeDeps.include'
Image

Issue

Json file imports should not be considered "dependency" and be optimized.

Minimal Reproduction

Add any json file import in an angular application and run ng serve.

Exception or Error


Your Environment

Angular CLI       : 21.2.13
Angular           : 21.2.15
Node.js           : 24.14.1
Package Manager   : npm 11.16.0
Operating System  : darwin x64

Anything else relevant?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions