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.

"TypeError: __webpack_require__.e is not a function" when using import()

See original GitHub issue

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

Command (mark with an x)

- [ ] new
- [ ] build
- [x] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Versions

Node v10.8.0
Npm v6.4.0

Angular CLI: 6.1.5
Node: 10.8.0
OS: win32 x64
Angular: 6.1.6
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.7.5
@angular-devkit/build-angular     0.7.5
@angular-devkit/build-optimizer   0.7.5
@angular-devkit/build-webpack     0.7.5
@angular-devkit/core              0.7.5
@angular-devkit/schematics        0.7.5
@angular/cli                      6.1.5
@ngtools/webpack                  6.1.5
@schematics/angular               0.7.5
@schematics/update                0.7.5
rxjs                              6.3.1
typescript                        2.7.2
webpack                           4.9.2

Repro steps

  1. Clone this repo and install npm dependencies.
  2. Run ng serve, and wait until you see a compilation error.
  3. Fix the typescript compilation error in app.component.ts (see comment in that file).
  4. Navigate to localhost:4200.
  5. You will see the error in the browser console.

The log given by the failure

ERROR TypeError: __webpack_require__.e is not a function
    at foo (foo.js:2)
    at new AppComponent (app.component.ts:15)
    at createClass (core.js:9299)
    at createDirectiveInstance (core.js:9186)
    at createViewNodes (core.js:10406)
    at createRootView (core.js:10320)
    at callWithDebugContext (core.js:11351)
    at Object.debugCreateRootView [as createRootView] (core.js:10838)
    at ComponentFactory_.push../node_modules/@angular/core/fesm5/core.js.ComponentFactory_.create (core.js:8666)
    at ComponentFactoryBoundToModule.push../node_modules/@angular/core/fesm5/core.js.ComponentFactoryBoundToModule.create (core.js:3315)

Desired functionality

The app should run with no errors.

Mention any other details that might be useful

The missing function __webpack_require__.e should be located in the webpack-generated file runtime.js, but in this case it is not there.

Issue Analytics

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

github_iconTop GitHub Comments

9reactions
theNotoriousHxccommented, Nov 30, 2018

Just had this problem. In my situation, i had imported a lazy-loaded module inside AppModule. So it was both assigned to loadChildren in route definition as well as imported on AppModule. The solution was just to remove the import of the lazy-loaded module on AppModule

1reaction
mgechevcommented, Aug 19, 2019

Let’s close the issue for now, since there seem to be a solution pointed out by @theNotoriousHxc. Please open a new ticket if this is still relevant.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Uncaught TypeError: __webpack_require__.e is not a function
Looks like the issue is sticking with package webpack-target-webextension itself. I quickly checked its repo and apparently there's an ...
Read more >
__webpack_require__ is not a function - You.com | The ...
This error can arise if you try to import something from an existing npm package (in node_modules ) but the imported thing doesn't...
Read more >
TypeError: require(...) is not a function in Node.js | bobbyhadz
Calling the result of require() when the imported file doesn't have a default export of a function. Having cyclic dependencies (imports and exports...
Read more >
Module Federation - webpack
It's not possible to use a remote module without a chunk loading operation. ... an import() call, but older constructs like require.ensure or...
Read more >
How to solve the "is not a function" error in JavaScript
js we use require() to load external modules and files. This can cause, in some cases, an error like this: TypeError: require(...) is...
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