Skip to content

compiler-cli: Component-level CSS causes error #11445

@sarunint

Description

@sarunint

I'm submitting a ... (check one with "x")

[x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior

Note: I'm not sure if this issue is an issue of @angular/compiler-cli or angular-cli
After compiling a style-embedded component, the compiler generates a .css.shim.ts file. But this file causes the following error while building:

ERROR in [default] C:\path\to\project\src\app\app.component.css.shim.ts:1:7
Property 'exports' does not exist on type '{ id: string; }'.

ERROR in [default] C:\path\to\project\src\app\app.component.ngfactory.ts:17:26
File 'C:/path/to/project/src/app/app.component.css.shim.ts' is not a module.

This is the content of app.component.css.shim.ts:

/**
 * This file is generated by the Angular 2 template compiler.
 * Do not edit.
 */
 /* tslint:disable */

export const styles:any[] = [''];

Expected behavior

.css.shim.ts files should not cause errors during build.

Reproduction of the problem

  1. Use angular-cli from the master branch - as the time of writing, I use angular/angular-cli@e20af21 (The latest release still on RC5)
  2. Generate a new project using ng new
  3. Install @angular/compiler-cli and its dependency, @angular/platform-server
  4. Compile the component using ./node_modules/.bin/ngc -p ./src
  5. Edit main.ts to look like this: https://gist.github.com/sarunint/d19269000028d504685f38f206410dc0
  6. Build using ng build or ng serve

Please tell us about your environment:
Tested on Windows 10 and Ubuntu 14.04 running NodeJS 6.5.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions