Uncaught ReferenceError: req is not defined with [email protected]
Bug Report or Feature Request (mark with an x)
- [x] bug report -> please search issues before submitting
- [ ] feature request
Versions.
Angular CLI: 1.5.0
Node: 7.9.0
OS: darwin x64
Angular: 4.4.6
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router, tsc-wrapped
@angular/cdk: 2.0.0-beta.12
@angular/cli: 1.5.0
@angular/flex-layout: 2.0.0-beta.9
@angular/material: 2.0.0-beta.12
@angular/service-worker: 1.0.0-beta.16
@angular-devkit/build-optimizer: 0.0.32
@angular-devkit/core: 0.0.20
@angular-devkit/schematics: 0.0.35
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.8.0
@schematics/angular: 0.1.0
typescript: 2.4.2
webpack: 3.8.1
Repro steps.
- Clone this repo: https://github.com/ngx-rocket/starter-kit
npm installnpm run start -- --prodorng serve --prod
The log given by the failure.
Build is successful, but app is throwing an error that seems to be due to zone.js polyfill:
polyfills.5ae6b10132b7e8411589.bundle.js:1 Uncaught ReferenceError: req is not defined
at polyfills.5ae6b10132b7e8411589.bundle.js:1
at polyfills.5ae6b10132b7e8411589.bundle.js:1
at polyfills.5ae6b10132b7e8411589.bundle.js:1
at Function.r.__load_patch (polyfills.5ae6b10132b7e8411589.bundle.js:1)
at polyfills.5ae6b10132b7e8411589.bundle.js:1
at u (polyfills.5ae6b10132b7e8411589.bundle.js:1)
at Object.<anonymous> (polyfills.5ae6b10132b7e8411589.bundle.js:1)
at Object.eFQL (polyfills.5ae6b10132b7e8411589.bundle.js:1)
at n (inline.f05f710f0631368b608c.bundle.js:1)
at Object.TU+8 (polyfills.5ae6b10132b7e8411589.bundle.js:1)
Desired functionality.
App does not throw any error.
Mention any other details that might be useful.
Was working fine with [email protected]
I am also getting this but not using cli directly just the new AngularCompilerPlugin. Seems the app still functions though.
This is actually a bug in uglify-es and looks like the next version should have a fix. Relevant issue: https://github.com/mishoo/UglifyJS2/issues/2437
Upgrading node.js to latest LTS version, re-installing [email protected] & upgrading typescript to 2.6.1 I got rid this anoying error after rebuild my project. Before this, I got unmeet peer dependency on typescript & other angular dependencies.
I got the same error here when upgrading a Angular 4.XX project to use with Angular-CLI 1.5
What's the workaround here? :)
Same error when upgrade to Angular 5.0.0 and Angular-CLI 1.5
I updated from the latest 5 RC to the final 5 version. After that I got this error and "Cannot read property 'subscribe' of undefined" for some routes which made it impossible to navigate to this routes.
Even downgrading to the latest 5RC did not work which might be happening because of some dependency which has no pinned version and the latest one is broken.
Only a downgrade to the latest Angular 4 did make it work again.
Btw: On Thursday I updated another project and there were no problems.
I have the same problem
Same here. Upgraded from 4.4 to 5
same issue cli 1.5, angular 5
Same here, using Angular 5 and CLI 1.5
Same!!!
It seems to be an CLI problem, Angular 4.4.6 and CLI 1.5 got the error
Angular 4.4.6 and CLI 1.4.9 everything works fine
I also get this error with Angular CLI 1.5.0 :/
We did the following (ugliest) workaround, in index.html:
<script>
window.req = window.dep = null;
</script>
Yeah, it's definitely a CLI error since reverting to 1.4.9 fixed the problem.
@bh86 that works but waiting for an official fix
Hoping it'd be fixed soon
Webpack’s uglifyjs plugin was updated in CLI 1.5 which replaced uglify-js with uglify-es. This currently has a bug in its collapse_var optimization which is the cause of the error.
I want to know how my app will be affected by this bug because it seem still work correctly. And do we have a work around for this issue?