Skip to content
This repository was archived by the owner on Nov 22, 2024. It is now read-only.

TypeError: __webpack_require__(...) is not a function #1195

Closed
jrodl3r opened this issue Jul 6, 2019 · 11 comments
Closed

TypeError: __webpack_require__(...) is not a function #1195

jrodl3r opened this issue Jul 6, 2019 · 11 comments
Labels

Comments

@jrodl3r
Copy link

jrodl3r commented Jul 6, 2019

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).

@vikerman
Copy link
Contributor

vikerman commented Jul 7, 2019

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

@jrodl3r
Copy link
Author

jrodl3r commented Jul 9, 2019

@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

@MarkPieszak
Copy link
Contributor

> 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

@jrodl3r
Copy link
Author

jrodl3r commented Jul 15, 2019

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

@vikerman
Copy link
Contributor

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?

@vikerman
Copy link
Contributor

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

@alamgirqazi
Copy link

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 (vikerman/v8-lazy@515239b).

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?

@alan-agius4
Copy link
Collaborator

@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
Copy link

@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.

@alan-agius4
Copy link
Collaborator

Let’s continue tracking this in #1207 since there is a repo.

Duplicate of #1207

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Feb 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants