Skip to content

Migration to v13 throws exception with ng-package.js #22107

@duykhang53

Description

@duykhang53

🐞 Bug report

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • extract-i18n
  • run
  • config
  • help
  • version
  • doc

Is this a regression?

No

Description

Failed migration from angular v12 to angular v13 for library project using js as ng-pacakgr

🔬 Minimal Reproduction

Migrate an angular library from v12 to v13 that contain js file for ng-packagr configuration (ng-package.js) then run
ng update --force --allow-dirty @angular/cli --from 12 --migrate-only

🔥 Exception or Error

[error] Error: Failed to parse "__/ng-package.prod.js" as JSON AST Object. InvalidSymbol at location: 0.
    at JSONFile.get JsonAst [as JsonAst] (__\node_modules\@angular\cli\node_modules\@schematics\angular\utility\json-file.js:39:19)
    at JSONFile.get (__\node_modules\@angular\cli\node_modules\@schematics\angular\utility\json-file.js:44:34)
    at JSONFile.remove (__\node_modules\@angular\cli\node_modules\@schematics\angular\utility\json-file.js:75:18)
    at __\node_modules\@angular\cli\node_modules\@schematics\angular\migrations\update-13\update-libraries.js:68:22

🌍 Your Environment




     _                      _                 ____ _     ___ 
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | | 
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | | 
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 13.0.1
Node: 16.10.0
Package Manager: npm 7.24.0
OS: win32 x64

Angular: 13.0.0
... animations, cdk, common, compiler, compiler-cli, core, forms
... language-service, material, platform-browser
... platform-browser-dynamic, platform-server, router
... service-worker

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1300.1
@angular-devkit/build-angular   13.0.1
@angular-devkit/core            12.0.5
@angular-devkit/schematics      12.0.5
@angular/cli                    13.0.1
@nguniversal/builders           12.1.3
@nguniversal/express-engine     12.1.3
@schematics/angular             12.0.5
ng-packagr                      13.0.3
rxjs                            6.6.7
typescript                      4.4.4

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions