Skip to content

ng-xi18n error when importing angular component from node_modules #3314

@reynardmh

Description

@reynardmh

OS?

Mac OSX (Sierra)

Versions.

angular-cli: 1.0.0-beta.20-4
node: 7.0.0
os: darwin x64

Repro steps.

I created the app with CLI, copied the tsconfig.json from src to the root project so ng-xi18n can run. Here is the reproducible repo with detailed explanation of what I did.

https://github.com/reynardmh/bugdemo-angular-i18n

basically ng serve works, and the app runs, but ng-xi18n failed because I imported CoolComponent from node_modules. If I don't import the CoolComponent, ng-xi18n works fine.

This bug was originally posted in angular project, but @vicb thought this is a CLI issue and asked to reopen it in the angular-cli project.

angular/angular#12760

The log given by the failure.

Error: Unexpected value 'CoolComponent' declared by the module 'AppModule'
    at /bugdemo-angular-i18n/node_modules/@angular/compiler/bundles/compiler.umd.js:14722:29
    at Array.forEach (native)
    at CompileMetadataResolver._loadNgModuleMetadata (/bugdemo-angular-i18n/node_modules/@angular/compiler/bundles/compiler.umd.js:14702:56)
    at CompileMetadataResolver.getUnloadedNgModuleMetadata (/bugdemo-angular-i18n/node_modules/@angular/compiler/bundles/compiler.umd.js:14636:23)
    at addNgModule (/bugdemo-angular-i18n/node_modules/@angular/compiler/bundles/compiler.umd.js:12944:43)
    at /bugdemo-angular-i18n/node_modules/@angular/compiler/bundles/compiler.umd.js:12957:16
    at Array.forEach (native)
    at _createNgModules (/bugdemo-angular-i18n/node_modules/@angular/compiler/bundles/compiler.umd.js:12956:28)
    at analyzeNgModules (/bugdemo-angular-i18n/node_modules/@angular/compiler/bundles/compiler.umd.js:12700:16)
    at Object.analyzeAndValidateNgModules (/bugdemo-angular-i18n/node_modules/@angular/compiler/bundles/compiler.umd.js:12704:20)
Extraction failed

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