From ec9f3713aa0b51158c33e545bc242c1e865d8853 Mon Sep 17 00:00:00 2001 From: xidedix Date: Tue, 1 Dec 2026 22:14:11 +0100 Subject: [PATCH] fix(schematics): load ng-add when the package is already installed Since 5.7.0 the packages are "type": "module" and the compiled schematics CommonJS, so ng add of an installed package and ng g :ng-add threw "exports is not defined in ES module scope". schematics/package.json sets the CommonJS scope; postbuild copies it and runs the built factory module, so the build fails when it stops loading. --- projects/coreui-angular-chartjs/package.json | 2 +- projects/coreui-angular-chartjs/schematics/package.json | 3 +++ projects/coreui-angular/package.json | 2 +- projects/coreui-angular/schematics/package.json | 3 +++ projects/coreui-icons-angular/package.json | 2 +- projects/coreui-icons-angular/schematics/package.json | 3 +++ 6 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 projects/coreui-angular-chartjs/schematics/package.json create mode 100644 projects/coreui-angular/schematics/package.json create mode 100644 projects/coreui-icons-angular/schematics/package.json diff --git a/projects/coreui-angular-chartjs/package.json b/projects/coreui-angular-chartjs/package.json index f13d95d5..884ee9ae 100644 --- a/projects/coreui-angular-chartjs/package.json +++ b/projects/coreui-angular-chartjs/package.json @@ -51,7 +51,7 @@ "schematics": "./schematics/collection.json", "scripts": { "build": "tsc -p tsconfig.schematics.json", - "postbuild": "copyfiles schematics/*/files/** schematics/collection.json ../../dist/coreui-angular-chartjs/" + "postbuild": "copyfiles schematics/*/files/** schematics/collection.json schematics/package.json ../../dist/coreui-angular-chartjs/ && node ../../dist/coreui-angular-chartjs/schematics/ng-add/index.js" }, "ng-add": { "save": true diff --git a/projects/coreui-angular-chartjs/schematics/package.json b/projects/coreui-angular-chartjs/schematics/package.json new file mode 100644 index 00000000..5bbefffb --- /dev/null +++ b/projects/coreui-angular-chartjs/schematics/package.json @@ -0,0 +1,3 @@ +{ + "type": "commonjs" +} diff --git a/projects/coreui-angular/package.json b/projects/coreui-angular/package.json index a5e85b52..314ca0e9 100644 --- a/projects/coreui-angular/package.json +++ b/projects/coreui-angular/package.json @@ -60,7 +60,7 @@ "schematics": "./schematics/collection.json", "scripts": { "build": "tsc -p tsconfig.schematics.json", - "postbuild": "copyfiles schematics/*/files/** schematics/collection.json ../../dist/coreui-angular/" + "postbuild": "copyfiles schematics/*/files/** schematics/collection.json schematics/package.json ../../dist/coreui-angular/ && node ../../dist/coreui-angular/schematics/ng-add/index.js" }, "ng-add": { "save": true diff --git a/projects/coreui-angular/schematics/package.json b/projects/coreui-angular/schematics/package.json new file mode 100644 index 00000000..5bbefffb --- /dev/null +++ b/projects/coreui-angular/schematics/package.json @@ -0,0 +1,3 @@ +{ + "type": "commonjs" +} diff --git a/projects/coreui-icons-angular/package.json b/projects/coreui-icons-angular/package.json index e6e18f72..5401054f 100644 --- a/projects/coreui-icons-angular/package.json +++ b/projects/coreui-icons-angular/package.json @@ -51,7 +51,7 @@ "schematics": "./schematics/collection.json", "scripts": { "build": "tsc -p tsconfig.schematics.json", - "postbuild": "copyfiles schematics/*/files/** schematics/collection.json ../../dist/coreui-icons-angular/" + "postbuild": "copyfiles schematics/*/files/** schematics/collection.json schematics/package.json ../../dist/coreui-icons-angular/ && node ../../dist/coreui-icons-angular/schematics/ng-add/index.js" }, "ng-add": { "save": true diff --git a/projects/coreui-icons-angular/schematics/package.json b/projects/coreui-icons-angular/schematics/package.json new file mode 100644 index 00000000..5bbefffb --- /dev/null +++ b/projects/coreui-icons-angular/schematics/package.json @@ -0,0 +1,3 @@ +{ + "type": "commonjs" +}