Open aikrez opened 1 year ago
What does your angular.json look like? The migration is set up to look for all tsconfigs in the angular.json.
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"angular-sixteen": {
"projectType": "application",
"schematics": {},
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/angular-sixteen",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": [
"zone.js"
],
"tsConfig": "tsconfig.app.json",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.css"
],
"scripts": []
},
"configurations": {
"production": {
"budgets": [
{
"type": "initial",
"maximumWarning": "500kb",
"maximumError": "1mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "2kb",
"maximumError": "4kb"
}
],
"outputHashing": "all"
},
"development": {
"buildOptimizer": false,
"optimization": false,
"vendorChunk": true,
"extractLicenses": false,
"sourceMap": true,
"namedChunks": true
}
},
"defaultConfiguration": "production"
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"configurations": {
"production": {
"browserTarget": "angular-sixteen:build:production"
},
"development": {
"browserTarget": "angular-sixteen:build:development"
}
},
"defaultConfiguration": "development"
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "angular-sixteen:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"polyfills": [
"zone.js",
"zone.js/testing"
],
"tsConfig": "tsconfig.spec.json",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.css"
],
"scripts": []
}
}
}
}
}
}```
Are there any updates on this issue ?
I have the same issue. Did you ever find any workable solution?
I have the same issue. Did you ever find any workable solution?
I only have the workaround that I provided in the first post. I haven't looked into the migration since then.
I also had this issue. The workaround solved it.
I ran into the same issue on my current project (Angular 17.2) and it seems like the main cause is not that only tsconfig.spec.json
will be used but whatever tsconfig is defined in "architect" > "test"
. So just for the migration procedure you could just change tsconfig.spec.json
to tsconfig.app.json
and switch it back when you're done.
At this point this issue is way bigger in our project as we don't have a test
configuration because we are using jest. And any other config gets ignored. If I try to migrate to standalone I get the error Could not find any tsconfig file. Cannot run the standalone migration.
. There is a esbuild
config containing tsConfig: tsconfig.app.json
(~even build
won't fix it~) which gets ignored but as soon as I add the test
section the migration starts as expected with whatever tsconfig I define in there.
P.S.
Just did a test and temporarily switched from esbuild
to build
and the migration went well. Anyway, I guess esbuild
should be added to the accepted project.targets
: https://github.com/angular/angular/blob/e92354570d6c171a5048dc5ce704596ce065b540/packages/core/schematics/utils/project_tsconfig_paths.ts#L26
"include": [ "src/*/.ts", "src/*/.d.ts" ]
The workaround works .. You saved my day
Command
generate
Is this a regression?
The previous version in which this bug was not present was
No response
Description
The standalone migration generator is using the tsconfig.spec.json and therefor does not find any files to migrate.
Minimal Reproduction
1 Create a new project with the Angular cli 2 add a new component and module and import it in app.module
3 Run the command
ng g @angular/core:standalone
Choose the type of migration: (Use arrow keys)Result � Automated migration step has finished! � IMPORTANT! Please verify manually that your application builds and behaves as expected. See https://angular.io/guide/standalone-migration for more information. UPDATE src/app/shouldremove/whatever/whatever.component.spec.ts (628 bytes)
The migration script only checks the files in the tsconfig.spec.json
When I change (ofc not the way to do it)
"include": [ "src/**/*.spec.ts", "src/**/*.d.ts" ]
to
"include": [ "src/**/*.ts", "src/**/*.d.ts" ]
it works correctly. The generator is using the wrong tsconfig file
Exception or Error
No response
Your Environment
Anything else relevant?
No response