October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk2 min

Angular NG6100: Why You Should Remove `id: module.id` from an NgModule

NG6100 warns about `id: module.id` in NgModule metadata. Remove it unless the app deliberately uses getNgModuleById() for module lookup.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Angular’s NG6100 warning is about id: module.id in @NgModule metadata. Angular calls it a common anti-pattern: the compiler ignores the declaration and warns because the NgModule ID is useful only when code deliberately looks up that module with getNgModuleById(). If your project does not use that lookup, remove the id property; you do not need to migrate the app away from NgModules to fix NG6100.

What NG6100 means

This warning identifies an NgModule configured like this:

As an Amazon Associate I earn from qualifying purchases.

@NgModule({
  id: module.id,
  // other metadata
})
export class FeatureModule {}

The id field is not a general-purpose module identifier. Angular provides it so a module can be retrieved by ID using getNgModuleById(). Angular describes the common module.id pattern as an anti-pattern, says the compiler ignores the declaration, and warns that it is likely not useful in the code: Angular’s NG6100 error entry.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How to fix the warning

  1. Search the project for getNgModuleById() and check whether the module is intentionally registered for a specific lookup or bundling arrangement.

  2. If the lookup is not used, remove only id: module.id from the NgModule metadata:

    @NgModule({
      // other metadata
    })
    export class FeatureModule {}
  3. Rebuild or run the project’s usual Angular checks and confirm NG6100 is gone.

There is no need to change unrelated NgModule metadata or undertake a wholesale framework migration just to address this warning.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

When an NgModule ID is actually useful

Keep an ID only when application code genuinely needs to retrieve an NgModule through getNgModuleById(). Angular describes this as rare, with use cases mainly involving bundling arrangements where a lazily loaded module must be accessed without a direct reference. The NgModule API reference documents the lookup API.

In that case, use a meaningful, stable string ID that matches the lookup design rather than assuming CommonJS module.id is suitable. Angular notes that this CommonJS value is usually opaque to consumers. Supplying an NgModule ID also makes the module non-tree-shakable and can affect bundle size; Angular does not publish a numerical size impact in its NG6100 guidance.

For ordinary lazy loading, use a direct import

Most code that needs to load a module dynamically should use ES dynamic import(), for example import('./path/to/module'). The caller receives a direct reference, avoiding the global registration side effect associated with looking up a module by ID. Angular recommends this approach for most code in its NG6100 guidance.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Why this pattern is often present

The NgModule id is sometimes confused with older component metadata. Earlier Angular versions sometimes used moduleId: module.id in @Component; that is a separate setting with a different history and purpose. An Angular framework issue opened on December 14, 2022, explains that Ivy does not respect @Component.moduleId for resource resolution as View Engine did: Angular issue #48490.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

That historical component field is not a reason to retain id: module.id on an NgModule. For current Angular guidance on working with existing modules and the framework’s direction for new code, see the NgModules guide.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.