问题
I am using angular 10 and angular material 10.
the angular material dialogue is not working in the production build (ng serve --prod
and ng build --prod
) but It is working fine local dev environment (ng serve
)
- I have already added the component in the
entryComponents
andbootstrap
- It is not throwing any kind of error in the console. what I can see is the card is loaded and no components inside the dialog are available,
- You can see the below screenshot, which is loading the card but not any component inside it.
回答1:
After a lot of research I found, the problem is with the IVY engine. For some people changing the below can solve the problem.
tsconfig.json
"angularCompilerOptions": {
"enableIvy": true
},
If you want to use the Ivy engine. the problem will be resolved if you update the Angular 10 project to Angular 11.
来源:https://stackoverflow.com/questions/65288802/the-angular-material-dialog-is-not-working-in-production-build