Coding⏱️ 1 min read📅 2026-06-03
How to Fix: Angular 8 - Lazy loading modules : Error TS1323: Dynamic import is only supported when '--module' flag is 'commonjs' or 'esNext'
TS1323 error in Angular lazy loading modules
Quick Answer: Use the 'lazy' module flag with ESNext syntax, or use the 'commonjs' flag for dynamic imports.
To resolve the Angular 8 lazy loading modules error TS1323, you need to add the '--module' flag when running the application.
💡 Solution
- Run your Angular application with the '--module' flag set to either 'commonjs' or 'esNext' as follows:
Example
- ng serve --module commonjs or ng serve --module esNext
This will resolve the error and enable dynamic imports in your Angular application.
❓ Frequently Asked Questions
Run your Angular application with the '--module' flag set to either 'commonjs' or 'esNext' as follows:
ng serve --module commonjs or ng serve --module esNext
🛠️ Related Fixes
How to Fix: Stuck in tutorial hell after 4 years: How do I b
Fix Stuck in tutorial hell after 4 years: How do I bui. Practice build
How to Fix: Trying to sync mutliple audio tracks to a movie
Fix Trying to sync mutliple audio tracks to a movie bu. Consider using
How to Fix: Failed to merge latest branches from upstream re
Fix Failed to merge latest branches from upstream repo. Try running 'g