Repository navigation
AOT compilation with npm linked module #2763
Copy link
Copy link
Closed
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
Description
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=sassThen 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 installFirst, 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
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
Activity
Meligy commentedon Oct 19, 2016
An earlier version of this comment said:
I now realise that this wrong, as the comment actually says (highlight mine):
Sorry for confusion.
clydin commentedon Oct 19, 2016
Libraries should be using peer dependencies for the needed angular packages. (This is why
--aotis failing).PR #2291 is forcing node resolution to only use your main app's
node_modules. It is essentially hiding the actual problem and also breaking more complicated dependency graphs. The problem is awesome-typescript-loader's dependency resolution. The loader appears to not be compensating for TS 2.0+'s use of realpath on symlinks which results in node's module resolution algorithm being executing on the wrong directory hierarchy.filipesilva commentedon May 22, 2017
#6292 adds guidance for linked libraries, but requires
1.1.0-rc.0minimum.angular-automatic-lock-bot commentedon Sep 7, 2019
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.