-
Notifications
You must be signed in to change notification settings - Fork 12k
ng update did not change my import statements #14589
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Can you also confirm that you were not using an RC or beta version of Angular CLi? |
@alan-agius4 not using an RC or beta. When I try to manually update the import statements, I'm getting a Typescript error: {
path: '',
pathMatch: 'full',
// loadChildren: './home/home.module#HomeModule',
loadChildren: () => import('./home/home.module').then(m => m.HomeModule),
data: { depth: 0 },
}, Here is my {
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"module": "es2015",
"types": []
},
"exclude": [
"src/test.ts",
"**/*.spec.ts"
]
} |
microsoft/TypeScript#16675 seems related here |
I see in a newly created v8 project the root UPDATE: I tried setting this manually in my root |
Those should have been migrated. We also automatically migrate the module in tsconfig to |
Any chance you can provide a repro of what you see? We test for this update so I'm not sure of what's going wrong. |
Sure, do you want me to do like a screen capture or something? Is there a debugging flag? Here is my repo (pre v8 upgrade): https://github.com/markgoho/glWp |
@markgoho the repo link seems to be incorrect as I am getting a 404 |
Whoops! I had it set to private. Should be good to go now. |
I had same issue. Migrated them using https://www.npmjs.com/package/@phenomnomnominal/angular-lazy-routes-fix instead... |
We're looking at how update behaves in your project and it's odd. It doesn't seem to be running the right migrations. Looks like it's related to npm hoisting, but unsure. |
I'm also getting this bug, Angular Material correctly updated my paths etc but my imports did not upgrade and I had to manually do it myself as well as change my module param in the |
Same problem with |
same problem
are there any info about the time this will be fixed? |
Just a note that ViewChild() also did not migrate automatically. |
A workaround for now is to run the following commands after you are already on Angular and CLI version 8:
|
The local CLI version needs to be 8.0.2 or greater for the migrate only part to work properly for these cases. |
Following worked for me:
Before above, I tried running:
But these only updated package.json. Not updated @ViewChild(), loadChildren and material imports. |
I found that the following steps should be followed to upgrade from 7 to 8:
|
@alexfung888 I opened angular/angular-update-guide#35 to track the issue of having to run a lot of |
Actually I can tolerate making lots of git commits, as long as the update guide didn't sound as if none is necessary. And a clean working tree has the advantage of easily restore when the update went south. More problematic is that on both repositories I tried, the update did not work and I need to do a separate --migrate-only with cli before the files (lazy loading modules, tsconfig.json, setting target to es2015 and the browserlist file) are updated. And the dependencies were not spelt out. Like I listed in my comment above, you need to manually upgrade typescript and flex-layout for the update to work. |
@alan-agius4 @filipesilva I briefly mentioned this in the GDE slack and it very much looks that my issue might be related to this. I created a reproduction repo here: https://github.com/juristr/ngv7upgradetest If you try to upgrade this repo with ..doesn't get upgraded. In fact if you take a look at the output log, the CLI schematics don't seem to be executed at all. Instead, by trial-and-error I found that for some reason it was due to the I'm very curious what the reason for this might be, so let me know in case you find a fix, or need help reproducing something. |
Ah yes, even with my procedure above, pwa is not updated and I need to manually align it with cli. |
@alexfung888 well, it's even less the problem that the |
Just as an additional note. In another project I had the same issue, removed the |
Unfortunately, there was a defect in the update functionality that was fixed in 8.0.2 that caused the wrong version of the |
Same here: Updating from 7.14 --> 8.10 Update routine did NOT update @ViewChild(), loadChildren and tsconfig. |
@mart2k What happens if you re-run the migrations manually afterwards again?
|
@juristr that worked for me. Thanks to all. |
I think the issue is you shouldn't have to manually run those migrate-only scripts. |
Exactly. Usually this shouldn't be necessary but read this comment: #14589 (comment) |
Updating to Angular 8.1.2 right now and had the same behaviour. |
Thanks for reporting this issue. This issue is now obsolete due to changes in the recent releases. Please update to the most recent Angular CLI version. If the problem persists after upgrading, please open a new issue, provide a simple repository reproducing the problem, and describe the difference between the expected and current behavior. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
🐞 Bug report
Command (mark with an
x
)Is this a regression?
No, this behavior did not exist prior to 8.x
Description
ran
ng update @angular/cli @angular/core
loadChildren
import statements were not updated to new syntax🔬 Minimal Reproduction
I haven't dug into the migration code, but I have my routes in a
app-routing.module.ts
file:🔥 Exception or Error
No error, just old import pattern instead of new.
🌍 Your Environment
I was on Angular 7.2.15 and this was part of the update process to 8.0.0.
Anything else relevant?
I'm wondering if the migration code is targeting a certain file or something else that would have excluded this file from being updated to the new import pattern.
Here's the last bit from the
ng update
command:The text was updated successfully, but these errors were encountered: