ReferenceError: ngDevMode is not defined
See original GitHub issueπ bug report
Affected Package
The issue is caused by package @angular/core
Is this a regression?
Not sureDescription
A clear and concise description of the problem...If there are compilation errors in a template (while using βng serveβ), I am seeing the error βReferenceError: ngDevMode is not definedβ when running in Firefox (60.6.1esr) or Edge. Chrome shows the actual compilation errors.
π¬ Minimal Reproduction
https://stackblitz.com/...Create simple app with a component. Introduce compilation errors. Try to run app in browser.
The error (with Angular 8.1.1 is in core.js:13393
π₯ Exception or Error
ReferenceError: ngDevMode is not defined
π Your Environment
Angular Version: 8.1.1 (also 8.1.0)
Anything else relevant?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:14
- Comments:33 (23 by maintainers)
Top Results From Across the Web
Cannot redeclare block-scoped variable 'ngDevMode'
I ran into the same error, although I think it was caused by a reference to a Typescript file located in a different...
Read more >uncaught referenceerror - ngdevmode is not defined
js. Solution 1: Using before defining - Uncaught ReferenceError: $ is not defined Case: Invoking the function or using a variable before declaring...
Read more >ngDevMode and ngI18nClosureMode undefined error
When I ran prod build, I get `ngI18nClosureMode is not defined' and 'ngDevMode is not defined' error. Nonprod(ng build) build is fine.
Read more >ERROR ReferenceError: Hammer is not defined (Help me)
I again here, I'm trying to install Universal Angular with mdbootstrap 6.2.2 and I have an error in the library hammer.js, I leave...
Read more >Angular: packages/core/src/util/ng_dev_mode.ts - Fossies
24 * Finally, ngDevMode may not have been defined at all. ... you can 102 * get a `ReferenceError` like in https://github.com/angular/angular/issues/31595.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Angular 8.2.0, I am using webpack configuration and running into the same issue when the β@angular-devkit/build-optimizer/webpack-loaderβ is part of the bundling process. I suppose this loadeder removes that variable.
Removing the loader from the rules fixes the issue (but results in not-optimized builds). This can be fixed by injecting the missing variables into the bundle, I have used webpack.DefinePlugin for that:
ngDevMode and ngI18nClosureMode are normally both defined in:
https://github.com/angular/angular/blob/78146c1890b472621acf33d778477db8df816043/packages/compiler-cli/src/tooling.ts
same issue. @angular/core 8.1.2 Is there any way to fix it?
Upd: it happens only for production build. Downgrade of all @angular/* to β~8.0.0β has solved the issue.