question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot find module 'src/app/product/product.module'

See original GitHub issue

Hi @mohammedzamakhan!

Thank you for writing this. Very handy indeed 😃

Angular CLI: 7.3.6
Node: 11.12.0
OS: darwin x64
Angular: 7.2.10
... animations, common, compiler, compiler-cli, core, elements
... forms, http, language-service, platform-browser
... platform-browser-dynamic, router, service-worker

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.13.6
@angular-devkit/build-angular      0.13.6
@angular-devkit/build-ng-packagr   0.13.6
@angular-devkit/build-optimizer    0.13.6
@angular-devkit/build-webpack      0.13.6
@angular-devkit/core               7.3.6
@angular-devkit/schematics         7.3.6
@angular/cdk                       7.3.5
@angular/cli                       7.3.6
@angular/flex-layout               7.0.0-beta.24
@angular/material                  7.3.5
@angular/pwa                       0.13.6
@ngtools/json-schema               1.1.0
@ngtools/webpack                   7.3.6
@schematics/angular                7.3.6
@schematics/update                 0.13.6
ng-packagr                         4.7.1
rxjs                               6.4.0
typescript                         3.2.4
webpack                            4.29.0

Here’s my module:

import {NgModule} from '@angular/core';
import {LandingComponent} from './landing/landing.component';
import {SharedModule} from '../shared/shared.module';

@NgModule({
  declarations: [LandingComponent],
  bootstrap: [LandingComponent],
  imports: [
    SharedModule
  ]
})
export class ProductModule { }

I followed your instructions. I registered a lazyModule in my project under options:

"lazyModules": [
  "projects/booking-engine/src/app/product/product.module"
]

I loaded the module like so:

LoadableModule.forRoot({
      appDir: 'src/app/',
      fileMappings: {
        product: 'src/app/product/product.module#ProductModule'
      }
    })

I tried to load the module using your directive and your service but both return an error. Cannot find module 'src/app/product/product.module'

FYI My project is a web component using Angular Elements.

Please let me know your thoughts.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
bjornharvoldcommented, Mar 26, 2019

Thank you @mohammedzamakhan! Works like a charm 😃

0reactions
mohammedzamakhancommented, Mar 25, 2019

Yeah it works for me

Read more comments on GitHub >

github_iconTop Results From Across the Web

1 - Stack Overflow
app/product-detail.component.ts(2,22): error TS2307: Cannot find module './product'. I saw many answer but didn't worked for me.
Read more >
error ts2307: cannot find module or its corresponding type ...
I am having SOMETIMES an issue message when I run the command "npm run build:xxx" happens randomly.. ERROR in src/app/framework/services/svg2image/svg-to-image.
Read more >
Cannot find module 'X' Error in TypeScript | bobbyhadz
The "Cannot find module or its corresponding type declarations" error occurs when TypeScript cannot locate a third-party or local module in our project....
Read more >
Cannot find module '@angular-devkit/build-angular ... - YouTube
... occurred: Cannot find module '@angular-devkit/build-angular/package.json'The above exception while running an angular app can be handl.
Read more >
How to fix Error: cannot find module "webpack" - Educative.io
Solution · 1. Install webpack in the local app folder · 2. Link webpack to your project.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found