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.

modules[moduleId].call is undefined running locally Angular Universal project with Lazy loading

See original GitHub issue

Bug report

What is the current behavior? Hi, I’m trying to run my project with Angular Universa locally but webpack gives an error. It is not able to load my modules. I’m using lazy loading and the module name uses hash. I think webpack is not able to find the modules. The error is:


/Users/-/WebstormProjects/-app/dist/server.js:47289
/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
         		                  ^

TypeError: Cannot read property 'call' of undefined
    at __webpack_require__ (/Users/-/WebstormProjects/-app/dist/server.js:47289:30)
    at Object.<anonymous> (/Users/-/WebstormProjects/-app/dist/server.js:148749:12)
    at Object.a12C (/Users/-/WebstormProjects/-app/dist/server.js:161547:30)
    at __webpack_require__ (/Users/-/WebstormProjects/-app/dist/server.js:47289:30)
    at module.exports.O9CF.extendStatics (/Users/andreaprimaverili/WebstormProjects/-app/dist/server.js:124094:117)
    at Object.O9CF (/Users/-/WebstormProjects/-app/dist/server.js:124096:2)
    at __webpack_require__ (/Users/-/WebstormProjects/-app/dist/server.js:47289:30)
    at Object.V7fC (/Users/-/WebstormProjects/-app/dist/server.js:134032:32)
    at __webpack_require__ (/Users/-/WebstormProjects/-app/dist/server.js:47289:30)
    at Object.K011 (/Users/-/WebstormProjects/-app/dist/server.js:118559:37)

If the current behavior is a bug, please provide the steps to reproduce. I ran the following commands: “build:ssr”: “npm run build:client-and-server-bundles && npm run compile:server” “serve:ssr”: “node local.js”,

Using Lazy loaded modules with hash names, eg my names are “56.65e412bc6525fe8d22a2.js”

What is the expected behavior?

Run with no error

Other relevant information:

ng version

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 8.1.3
Node: 10.16.3
OS: darwin x64
Angular: 8.2.4
... common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                                    Version
--------------------------------------------------------------------
@angular-devkit/architect                  0.803.2
@angular-devkit/build-angular              0.803.2
@angular-devkit/build-optimizer            0.803.2
@angular-devkit/build-webpack              0.13.8
@angular-devkit/core                       8.3.2
@angular-devkit/schematics                 8.3.2
@angular/animations                        8.2.10
@angular/cli                               8.1.3
@angular/http                              7.2.2
@angular/platform-server                   8.2.14
@ngtools/webpack                           8.3.2
@nguniversal/common                        8.1.0
@nguniversal/express-engine                8.2.6
@nguniversal/module-map-ngfactory-loader   8.2.6
@schematics/angular                        8.1.3
@schematics/update                         0.801.3
rxjs                                       6.5.3
typescript                                 3.5.3
webpack                                    4.39.2

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
sokracommented, May 9, 2020

externals: { fsevents: “require(‘fsevents’)”, ‘./dist/server/main’: ‘require(“./server/main”)’ },

  externals: {
      fsevents: "fsevents",
      './dist/server/main': './server/main'
	},
0reactions
ilprimacommented, May 9, 2020

externals: { fsevents: “require(‘fsevents’)”, ‘./dist/server/main’: ‘require(“./server/main”)’ },

  externals: {
      fsevents: "fsevents",
      './dist/server/main': './server/main'
	},

Yes I already resolved with this. Seems like the official Ionic guide is wrong

Read more comments on GitHub >

github_iconTop Results From Across the Web

SSR Angular 8 application have lazy-load modules as ...
The problem is that there are two copies of Angular in the older way of setting up Universal and it confuses the lazy...
Read more >
webpack/webpack - Gitter
@sokra Quick Question: How to configure the Webpack Dev server so that I put a folder called public that is a sub-folder of...
Read more >
Lazy loading needed in Angular Universal? : r/Angular2 - Reddit
It will not call the server every time the user change page. So it is important to use lazyloading to minimize your bundle...
Read more >
The Complete Guide To Angular Load Time Optimization
The advice all sound something like: “Just use lazy loading”; “Check your bundle sizes”; “Just use Angular Universal” ...
Read more >
Automated Malware Analysis Report for https://u7243388.ct ...
Report size getting too big, too many NtCreateFile calls found. ... Users\user\AppData\Local\Microsoft\Windows\INetCache\IE\KSU5XQMC\sentry-lazy-load[1].js.
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