Universal: TypeError: __webpack_require__(...) is not a function

Created on 6 Jul 2019  路  11Comments  路  Source: angular/universal

getting this error on google cloud instance

TypeError: __webpack_require__(...) is not a function
    at Function.requireEnsure [as e] (/srv/dist/server.js:142734:49)

line 142734

var chunk = __webpack_require__(421)("./" + ({"components-_admin-admin-module-ngfactory":
"components-_admin-admin-module-ngfactory"}[chunkId]||chunkId) + ".js");

What is the expected behavior?

Everything is working fine w/ new angualrfire auth-guards + v8 import-style lazy-loaded routes/modules, just getting this error (as well as #1169).

FAQ

Most helpful comment

This seems a problem with angularfire. We are going to follow up with them.

Till then the workaround is to remove --bundleDependencies all from package.json

All 11 comments

Can you please refer to the version 8 upgrade guide and see if it resolves your issue?

https://github.com/angular/universal/blob/master/docs/v8-upgrade-guide.md

@vikerman Dude, far out! That cleared all my errors/warnings out : ) will post code later 馃憤

Update: everything works fine _without_ --bundleDependencies all. however, after adding that flag things start to break: https://gist.github.com/jrodl3r/4fb00a40011d02a0c3f0bde1afc99930

> node dist/server

/app/dist/server/main.js:166877
        throw new Error("package.json does not exist at " + package_json_path);
        ^

Error: package.json does not exist at /app/dist/package.json

@jrodl3r

Are you trying to access your package.json from your Node server file itself? This seems like it might be something a bit separate from Universal

Are you trying to access your package.json from your Node server file itself?

@MarkPieszak not intentionally, just a stock angular universal setup running on gcloud instance (node 10). Thx

The package.json error seems to be a duplicate of #1207
It seems we need a way to keep certain library as external and not try to bundle them as they don't work well bundled.

Can you provide info on which library the package.json might be referring to?

This seems a problem with angularfire. We are going to follow up with them.

Till then the workaround is to remove --bundleDependencies all from package.json

This seems a problem with angularfire. We are going to follow up with them.

Till then the workaround is to remove --bundleDependencies all from package.json

Hi, I tried the version upgrade after Upgrading to Angular 8. this one (https://github.com/vikerman/v8-lazy/commit/515239be1b233946e4a1d15a8712a0bc9f5490cc).

Now, when I'm building project, I get this error

> node dist/server

....\node_modules\ng2-al-slim-bar\src\slim-loading-bar.component.js:13
import { Component, Input, ChangeDetectorRef, ChangeDetectionStrategy, ElementRef } from '@angular/core';
       ^

SyntaxError: Unexpected token {

I tried adding module: "commonjs" to tsconfig.server.ts but it didnot work.

I tried it with

--bundleDependencies all

and also without it but same response.

Can you help me out here ? thanks. Surely this isn't a single library issue right?

@alamgirqazi, the error you are reporting seems to be different from TypeError: __webpack_require__(...) is not a function please file a new issue together with a reproduction that we can take a look at.

Thanks.

@alamgirqazi, the error you are reporting seems to be different from TypeError: __webpack_require__(...) is not a function please file a new issue together with a reproduction that we can take a look at.

Thanks.

I found a fix for this. It was just a library issue.

Let鈥檚 continue tracking this in #1207 since there is a repo.

Duplicate of #1207

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

babarinde picture babarinde  路  5Comments

benrondeau picture benrondeau  路  5Comments

moczix picture moczix  路  5Comments

PatrickJS picture PatrickJS  路  5Comments

daright picture daright  路  6Comments