Skip to content

cli fails to compile with ViewEncapsulation.None, --aot and styleUrls #3399

@borislemke

Description

@borislemke

Please provide us with the following information:

OS?

OS X El Capitan

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.21
node: 6.9.1
os: darwin x64

Repro steps.

Was this an app that wasn't created using the CLI? What change did you do on your code? etc.

Default cli configuration

The log given by the failure.

Normally this include a stack trace and some more information.

error_handler.js:53 TypeError: Cannot read property 'replace' of undefined
    at flattenStyles (dom_renderer.js:301)
    at new DomRenderer (dom_renderer.js:80)
    at DomRootRenderer_.DomRootRenderer.renderComponent (dom_renderer.js:38)
    at DebugDomRootRenderer.renderComponent (debug_renderer.js:15)
    at ViewUtils.renderComponent (view_utils.js:23)
    at View_AppComponent0.AppView (view.js:50)
    at new View_AppComponent0 (app.component.ngfactory.ts:107)
    at View_AppComponent_Host0.createInternal (app.component.ngfactory.ts:71)
    at View_AppComponent_Host0.AppView.createHostView (view.js:81)
    at ComponentFactory.create (component_factory.js:154)

Mention any other details that might be useful.

The compiler fails to compile with --aot flag if a styleUrls is specified on a component that has ViewEncapsulation.None. Removing the encapsulation and including the stylesheet in angular-cli.json works but is not intuitive. This should be mentioned somewhere in the docs or fixed to resolve the issue.


Thanks! We'll be in touch soon.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions