-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
Describe the bug
The @cubejs-client/ngx package's package.json contains an outdated Angular Package Format (APF) configuration referencing non-existent files or targets. This issue arises after upgrading @cubejs-client/ngx from v1.0.0 to v1.1.2.
The problem appears to be caused by a security-related dependency upgrade where Cube.js maintainers updated all Angular devDependencies from version 12 to version 13. This upgrade changed the output format/structure of the library, rendering it incompatible with the existing APF configuration in the package.json file.
To Reproduce
Steps to reproduce the behavior:
- Create an empty angular project
- Install cubejs core and cubejs angular client as documented pinning to versions for v1.0.0
- Add CubeJS module to the main module just to include cubejs in the output build
- Notice the project will be built normally
- Upgrade to the cube dependencies to the latest v1.1.2
- Notice that the build will fail mentioning that the library cube is pointing to files not included in the export
Error: Module not found: Error: Can't resolve '@cubejs-client/ngx'
An unhandled exception occurred: Failed to resolve entry for package "@cubejs-client/ngx". The package may have incorrect main/module/exports specified in its package.json.
package.json
{
"name": "@cubejs-client/ngx",
"version": "1.0.0",
"author": "Cube Dev, Inc.",
"engines": {},
"repository": {
"type": "git",
"url": "https://github.com/cube-js/cube.git",
"directory": "packages/cubejs-client-ngx"
},
"description": "Cube.js client for Angular",
"main": "dist/bundles/cubejs-client-ngx.umd.js",
"files": [
"dist"
],
"license": "MIT",
"watch": {
"dev:publish": "dist/*"
},
"scripts": {
"build": "./node_modules/ng-packagr/cli/main.js -c tsconfig.json -p ng-package.json && rm dist/package.json",
"ng:watch": "./node_modules/ng-packagr/cli/main.js -c tsconfig.json -p ng-package.json --watch && rm dist/package.json",
"dev": "yarn build && yalc publish --push"
},
"dependencies": {
"fast-deep-equal": "^3.1.3",
"tslib": "^2.0.0"
},
"devDependencies": {
"@angular-devkit/build-angular": "^12.1.2",
"@angular/cli": "^12.1.2",
"@angular/compiler": "^12.1.2",
"@angular/compiler-cli": "^12.1.2",
"@angular/core": "^12.1.2",
"ng-packagr": "^12.1.2",
"npm-watch": "^0.7.0",
"tsickle": "^0.39.1",
"typescript": "~4.3.5"
},
"peerDependencies": {
"@cubejs-client/core": ">=0.28.1",
"rxjs": ">=6.6.0"
},
"publishConfig": {
"access": "public"
},
"module": "dist/fesm2015/cubejs-client-ngx.js",
"es2015_ivy_ngcc": "__ivy_ngcc__/dist/fesm2015/cubejs-client-ngx.js",
"es2015": "dist/fesm2015/cubejs-client-ngx.js",
"esm5": "dist/esm5/cubejs-client-ngx.js",
"esm2015": "dist/esm2015/cubejs-client-ngx.js",
"fesm5": "dist/fesm5/cubejs-client-ngx.js",
"fesm2015_ivy_ngcc": "__ivy_ngcc__/dist/fesm2015/cubejs-client-ngx.js",
"fesm2015": "dist/fesm2015/cubejs-client-ngx.js",
"typings": "dist/cubejs-client-ngx.d.ts",
"metadata": "dist/cubejs-client-ngx.metadata.json",
"sideEffects": false,
}v1.0.0 Library Output: The output files for v1.0.0 include the expected bundles and file structure:
dist
├── LICENSE
├── README.md
├── bundles
│ ├── cubejs-client-ngx.umd.js
│ └── cubejs-client-ngx.umd.js.map
├── cubejs-client-ngx.d.ts
├── esm2015
│ ├── cubejs-client-ngx.js
│ ├── index.js
│ └── src
├── fesm2015
│ ├── cubejs-client-ngx.js
│ └── cubejs-client-ngx.js.map
├── index.d.ts
└── src
├── client.d.ts
├── module.d.ts
├── public_api.d.ts
└── query-builder
7 directories, 13 files
v1.1.2 Library Output: The output files for v1.1.2 have a different structure:
dist
├── LICENSE
├── README.md
├── cubejs-client-ngx.d.ts
├── esm2020
│ ├── cubejs-client-ngx.mjs
│ ├── index.mjs
│ └── src
├── fesm2015
│ ├── cubejs-client-ngx.mjs
│ └── cubejs-client-ngx.mjs.map
├── fesm2020
│ ├── cubejs-client-ngx.mjs
│ └── cubejs-client-ngx.mjs.map
├── index.d.ts
└── src
├── client.d.ts
├── module.d.ts
├── public_api.d.ts
└── query-builder
7 directories, 13 files
The conflict between these versions suggests that the package.json APF configuration has not been updated to reflect the new structure introduced in v1.1.2.
Version:
v1.1.2
Additional context
- The ng-packagr tool automatically generates the correct APF structure during the build process. Any manual modifications to the APF configuration in package.json should be avoided.
- The issue likely affects projects using Angular versions compatible with APF v12 or earlier.
- Old APF Reference
- New APF Reference
- Breaking Pull Request : upgrade @angular-devkit/* because of minimatch chore: update packages #9012