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

  1. ng serve --module commonjs or ng serve --module esNext

This will resolve the error and enable dynamic imports in your Angular application.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions