Angular-cli: export 'SafeUrl' was not found in '@angular/platform-browser'

Created on 7 Nov 2016  路  3Comments  路  Source: angular/angular-cli

Please provide us with the following information:

OS?

Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)
Windows 10 x64

Versions.

Please run ng --version. If there's nothing outputted, please run in a Terminal: node --version and paste the result here:
angular-cli: 1.0.0-beta.15
node: 6.5.0
os: win32 x64

Repro steps.

Was this an app that wasn't created using the CLI? What change did you do on your code? etc.
Yes, this app was created using the CLI.
I added the SafeUrl to a class
import { SafeUrl } from '@angular/platform-browser';

When I run or build the application I get the following in the CLI build i get:

Version: webpack 2.1.0-beta.22
Time: 25131ms
Asset Size Chunks Chunk Names
448c34a56d699c29117adc64c43affeb.woff2 18 kB [emitted]
f4769f9bdb7466be65088239c12046d1.eot 20.1 kB [emitted]
d7c639084f684d66a1bc66855d193ed8.svg 392 kB [emitted]
1dc35d25e61d819a9c357074014867ab.ttf 153 kB [emitted]
c8ddf1e5e5bf3682bc7bebf30f394148.woff 90.4 kB [emitted]
e6cf7c6ec7c2d6f670ae9d762604cb0b.woff2 71.9 kB [emitted]
89889688147bd7575d6327160d64e760.svg 109 kB [emitted]
e18bbf611f2a2e43afc071aa2f4e1512.ttf 45.4 kB [emitted]
fa2772327f55d8198301fdb8bcfc8158.woff 23.4 kB [emitted]
25a32416abee198dd821b0b17a198a8f.eot 76.5 kB [emitted]
main.bundle.js 7.16 MB 0, 2 [emitted] main
styles.bundle.js 246 kB 1, 2 [emitted] styles
inline.js 5.53 kB 2 [emitted] inline
main.map 8.02 MB 0, 2 [emitted] main
styles.map 339 kB 1, 2 [emitted] styles
inline.map 5.59 kB 2 [emitted] inline
index.html 2.24 kB [emitted]
assets/.npmignore 0 bytes [emitted]

WARNING in ./src/app/profile/profile-resume/profile-resume.component.ts
125:55 export 'SafeUrl' was not found in '@angular/platform-browser'

WARNING in ./src/app/profile/profile-resume/profile-resume.component.ts
125:82 export 'SafeUrl' was not found in '@angular/platform-browser'
Child html-webpack-plugin for "index.html":
Asset Size Chunks Chunk Names
index.html 4.71 kB 0
webpack: bundle is now VALID.

And in Chrome developer tools i get:

export 'SafeUrl' was not found in '@angular/platform-browser'
Error: export 'SafeUrl' was not found in '@angular/platform-browser'
at HarmonyImportSpecifierDependency.getWarnings

The log given by the failure.

Normally this include a stack trace and some more information.

Mention any other details that might be useful.


Thanks! We'll be in touch soon.

Most helpful comment

I have had this problem too.
The following trick removes the warning :

private safeUrl: SafeResourceUrl | string;

I'm not convinced this is the way it's supposed to be dealed with, but well, at least, there's no compilation warning.

All 3 comments

This doesn't seem to be a CLI problem. As the typescript error indicates, you're tying to import something that isn't there.

I have had this problem too.
The following trick removes the warning :

private safeUrl: SafeResourceUrl | string;

I'm not convinced this is the way it's supposed to be dealed with, but well, at least, there's no compilation warning.

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