Angular-cli: On upgrading to 1.5.0-rc.3 getting error: 'Uncaught ReferenceError: platformBrowser is not defined'

Created on 24 Oct 2017  路  11Comments  路  Source: angular/angular-cli

Bug Report or Feature Request:

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

On upgrading to 1.5.0-rc.3 getting error:

app.main.ts:11 Uncaught ReferenceError: platformBrowser is not defined
at eval (app.main.ts:11)
at Object.../../../../../src/scripts/app/app.main.ts (main.bundle.js:46)
at __webpack_require__ (inline.bundle.js:55)
at Object.0 (main.bundle.js:645)
at __webpack_require__ (inline.bundle.js:55)
at webpackJsonpCallback (inline.bundle.js:26)
at main.bundle.js:1

when I run:

ng serve --environment dev --aot true

My app.main.ts contains:

import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app.module';
import { environment } from '../environments/environment';
if (environment.production) {
enableProdMode();
}
platformBrowserDynamic().bootstrapModule(AppModule).catch(err => console.log(err));

On downgrading back to 1.5.0-rc.2 error goes away

Versions:


@angular/cli 1.5.0-rc.3

Repro steps:


Upgrade to 1.5.0-rc.3 and run:

ng serve --environment dev --aot true

The log given by the failure:


app.main.ts:11 Uncaught ReferenceError: platformBrowser is not defined
at eval (app.main.ts:11)
at Object.../../../../../src/scripts/app/app.main.ts (main.bundle.js:46)
at __webpack_require__ (inline.bundle.js:55)
at Object.0 (main.bundle.js:645)
at __webpack_require__ (inline.bundle.js:55)
at webpackJsonpCallback (inline.bundle.js:26)
at main.bundle.js:1

repro steps

Most helpful comment

Can you try upgrading to 1.5.0-rc.4? This issue might've been fixed by https://github.com/angular/angular-cli/commit/450383c2bf9ca162dd8ed01f410071a456677d45

All 11 comments

Same here. Rolling back to rc.2 resolves the issue

Can you setup a minimal repro please? You can read here why this is needed. A good way to make a minimal repro is to create a new app via ng new repro-app and adding the minimum possible code to show the problem. Then you can push this repository to github and link it here.

Issue is occurring with angular 5 rc 5. Here is the repro URL:
https://github.com/achinth/angular-cli1.5-bug-repro

I confirm the same issue also @[email protected]. I'm trying to run ng serve --aot.

I'm not sure if it's working for JIT though.

PS: downgrading to @angular/[email protected] works.

Can you try upgrading to 1.5.0-rc.4? This issue might've been fixed by https://github.com/angular/angular-cli/commit/450383c2bf9ca162dd8ed01f410071a456677d45

Perfect! It's working on 1.5.0-rc4. Thanks guys! Awesome!

Working in 1.5.0-rc5

Thanks for validating the fix, will close 馃憤

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

Was this page helpful?
0 / 5 - 0 ratings