Angular 5 - Unprepared ReferenceError: req not defined

I recently upgraded the current project from Angular 4.4.3 to Angular5. I upgraded all Angular packages to Angular 5.0.0 in accordance with the upgrade guide.

Plus, I also updated the Angular CLI to 1.5.0. Since then, I get below console errors:

polyfills.b8a5e5b.bundle.js:1 Uncaught ReferenceError: req is not defined
    at polyfills.b8a5e5b.bundle.js:1
    at polyfills.b8a5e5b.bundle.js:1
    at polyfills.b8a5e5b.bundle.js:1
    at Function.r.__load_patch (polyfills.b8a5e5b.bundle.js:1)
    at polyfills.b8a5e5b.bundle.js:1
    at c (polyfills.b8a5e5b.bundle.js:1)
    at Object.<anonymous> (polyfills.b8a5e5b.bundle.js:1)
    at Object.eFQL (polyfills.b8a5e5b.bundle.js:1)
    at n (inline.904a54f.bundle.js:1)
    at Object.TU+8 (polyfills.b8a5e5b.bundle.js:1)

Am I missing something?

+4
source share
4 answers

Remove node_modulesand run npm install.

This works for me.

+2
source

This is actually just a mistake with uglify-es. Upgrade uglify-esyour project to >3.1.8until it is fixed in the CLI. Got a response from here

+4
source

, CLI uglify-es. CLI 1.4.9.

:

  • node_modules .

  • npm install

  • Ctrl+Windows%appdata%npmnode_modules@angular

  • cli

  • CLI npm install -g @angular/cli@1.4.9

+2
  • npm (npm cache clear --force)
  • node_modules
  • (npm install)
  • uglify-es (npm install uglify-es@latest)
  • 1.6.0-beta.0 @angular/cli ( , [npm install @angular/cli@1.6.0-beta.0])
  • , npm, Angular 5
  • ,

, 5, .

0

Source: https://habr.com/ru/post/1688845/


All Articles