Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

AOT compilation with npm linked module #2763

Copy link
Copy link
@PonyLux

Description

@PonyLux
Issue body actions

OS?

Windows 7

Versions.

ng --version

angular-cli: 1.0.0-beta.17
node: 6.5.0

Repro steps.

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

I made 3 projects:

ng new app --style=sass

ng new auth --style=sass

ng new common --style=sass

Then I linked common and auth to app:

cd auth
npm install
npm link
cd ../common
npm install
npm link
cd ../app
npm link auth
npm link common
npm install

First, I get an error
Unexpected value 'CommonModule' imported by the module 'AppModule' Error: Unexpected value 'CommonModule' imported by the module 'AppModule'

While running ng serve.
I saw that this error was fix by the PR #2291

So I tryied to copy/paste the fix = > then ng serve worked.

I try after that to compile in AOT mode but I get exactly the same error

The command I run:
ng build --target=production --aot

The log given by the failure.

$ ng build --target=production --aot                                                                   0% compilingUnexpected value 'CommonModule' imported by the module 'AppModule'
Error: Unexpected value 'CommonModule' imported by the module 'AppModule'
    at C:\xampp\htdocs\front\app\node_modules\@angular\compiler\bundles\compiler.umd.js:14126:37
    at Array.forEach (native)
    at CompileMetadataResolver.getNgModuleMetadata (C:\xampp\htdocs\front\app\node_modules\@angular\compiler\bundles\compiler.umd.js:14111:46)
    at C:\xampp\htdocs\front\app\node_modules\@angular\compiler\bundles\compiler.umd.js:12952:58
    at Array.forEach (native)
    at OfflineCompiler.analyzeModules (C:\xampp\htdocs\front\app\node_modules\@angular\compiler\bundles\compiler.umd.js:12951:21)
    at CodeGenerator.codegen (C:\Users\iminar\Dev\angular\modules\@angular\compiler-cli\src\codegen.ts:110:45)
    at AotPlugin._make (C:\xampp\htdocs\front\app\node_modules\@ngtools\webpack\src\plugin.js:186:43)
    at Compiler.<anonymous> (C:\xampp\htdocs\front\app\node_modules\@ngtools\webpack\src\plugin.js:151:75)
    at Compiler.applyPluginsParallel (C:\xampp\htdocs\front\app\node_modules\tapable\lib\Tapable.js:156:14)
    at Compiler.<anonymous> (C:\xampp\htdocs\front\app\node_modules\webpack\lib\Compiler.js:463:8)
    at Compiler.applyPluginsAsync (C:\xampp\htdocs\front\app\node_modules\tapable\lib\Tapable.js:73:70)
    at Compiler.compile (C:\xampp\htdocs\front\app\node_modules\webpack\lib\Compiler.js:456:7)
    at Compiler.<anonymous> (C:\xampp\htdocs\front\app\node_modules\webpack\lib\Compiler.js:219:10)
    at Compiler.readRecords (C:\xampp\htdocs\front\app\node_modules\webpack\lib\Compiler.js:367:10)
    at Compiler.<anonymous> (C:\xampp\htdocs\front\app\node_modules\webpack\lib\Compiler.js:216:9)
    at next (C:\xampp\htdocs\front\app\node_modules\tapable\lib\Tapable.js:81:11)
    at Compiler.<anonymous> (C:\xampp\htdocs\front\app\node_modules\webpack\lib\CachePlugin.js:34:58)
    at Compiler.applyPluginsAsync (C:\xampp\htdocs\front\app\node_modules\tapable\lib\Tapable.js:85:13)
    at Compiler.<anonymous> (C:\xampp\htdocs\front\app\node_modules\webpack\lib\Compiler.js:213:8)
    at next (C:\xampp\htdocs\front\app\node_modules\tapable\lib\Tapable.js:81:11)
    at Compiler.<anonymous> (C:\xampp\htdocs\front\app\node_modules\webpack\lib\node\NodeEnvironmentPlugin.js:23:3)
    at Compiler.applyPluginsAsync (C:\xampp\htdocs\front\app\node_modules\tapable\lib\Tapable.js:85:13)
    at Compiler.run (C:\xampp\htdocs\front\app\node_modules\webpack\lib\Compiler.js:210:7)
    at C:\xampp\htdocs\front\app\node_modules\angular-cli\tasks\build-webpack.js:26:29
    at Class.run (C:\xampp\htdocs\front\app\node_modules\angular-cli\tasks\build-webpack.js:25:16)
    at Class.run (C:\xampp\htdocs\front\app\node_modules\angular-cli\commands\build.js:50:26)
    at Class.<anonymous> (C:\xampp\htdocs\front\app\node_modules\angular-cli\lib\models\command.js:152:17)
    at tryCatch (C:\xampp\htdocs\front\app\node_modules\rsvp\dist\lib\rsvp\-internal.js:215:12)
    at invokeCallback (C:\xampp\htdocs\front\app\node_modules\rsvp\dist\lib\rsvp\-internal.js:230:13)
    at C:\xampp\htdocs\front\app\node_modules\rsvp\dist\lib\rsvp\then.js:29:16
    at flush (C:\xampp\htdocs\front\app\node_modules\rsvp\dist\lib\rsvp\asap.js:85:5)
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickCallback (internal/process/next_tick.js:98:9)

Mention any other details that might be useful.

The package.json

"dependencies": {
    "@angular/common": "2.0.0",
    "@angular/compiler": "2.0.0",
    "@angular/core": "2.0.0",
    "@angular/forms": "2.0.0",
    "@angular/http": "2.0.0",
    "@angular/platform-browser": "2.0.0",
    "@angular/platform-browser-dynamic": "2.0.0",
    "@angular/router": "3.0.0",
    "core-js": "2.4.1",
    "rxjs": "5.0.0-beta.12",
    "ts-helpers": "1.1.1",
    "zone.js": "0.6.23",
    "auth": "0.0.0",
    "common": "0.0.0"
  },
  "devDependencies": {
    "@types/jasmine": "2.2.30",
    "@types/node": "6.0.42",
    "angular-cli": "1.0.0-beta.17",
    "codelyzer": "0.0.26",
    "jasmine-core": "2.4.1",
    "jasmine-spec-reporter": "2.5.0",
    "karma": "1.2.0",
    "karma-chrome-launcher": "2.0.0",
    "karma-cli": "1.0.1",
    "karma-jasmine": "1.0.2",
    "karma-remap-istanbul": "0.2.1",
    "protractor": "4.0.9",
    "ts-node": "1.2.1",
    "tslint": "3.13.0",
    "typescript": "2.0.2"
  }

Note: I get the same result if I use the master instead of the last release.

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentAn issue that is relevant to core functions, but does not impede progress. Important, but not urgentneeds: investigationRequires some digging to determine if action is neededRequires some digging to determine if action is neededtype: bug/fix

    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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.