dfbaskin / lerna-angular-cli-monorepo Goto Github PK
View Code? Open in Web Editor NEWDemonstration of using a Lerna monorepo with Angular CLI and ng-packagr.
License: MIT License
Demonstration of using a Lerna monorepo with Angular CLI and ng-packagr.
License: MIT License
For the "four" example, I've compiled an Angular module and I am trying to load it dynamically. The "three" example is similar and it works, but it is loaded by a direct reference. Tried all of these variations to load it:
// None of these options work:
{
path: "four",
//loadChildren: "demo-app-example-four/dist#ExampleFourModule"
//loadChildren: "../../node_modules/demo-app-example-four/dist#ExampleFourModule"
//loadChildren: "../../../demo-app-example-four/src/app/modules/example-four/example-four.module#ExampleFourModule"
},
When building the main web application (after building the libraries for the "three" and "four" examples), the build fails with the following error:
ERROR in Error: Error encountered resolving symbol values statically. Function calls are not supported.
Consider replacing the function or lambda with a reference to an exported function (position 194:50 in the original .ts file),
resolving symbol NgModule in /home/dfbaskin/dev/lerna-angular-cli-monorepo/packages/demo-app-main/node_modules/demo-app-example-three/node_modules/@angular/core/core.d.ts, resolving symbol ExampleThreeModule in /home/dfbaskin/dev/lerna-angular-cli-monorepo/packages/demo-app-main/node_modules/demo-app-example-three/dist/demo-app-example-three.d.ts, resolving symbol ExampleThreeModule in /home/dfbaskin/dev/lerna-angular-cli-monorepo/packages/demo-app-main/node_modules/demo-app-example-three/dist/demo-app-example-three.d.ts
at positionalError (/home/dfbaskin/dev/lerna-angular-cli-monorepo/packages/demo-app-main/node_modules/@angular/compiler/bundles/compiler.umd.js:25266:35)
at simplifyInContext (/home/dfbaskin/dev/lerna-angular-cli-monorepo/packages/demo-app-main/node_modules/@angular/compiler/bundles/compiler.umd.js:25109:27)
at StaticReflector.simplify (/home/dfbaskin/dev/lerna-angular-cli-monorepo/packages/demo-app-main/node_modules/@angular/compiler/bundles/compiler.umd.js:25123:13)
at StaticReflector.annotations (/home/dfbaskin/dev/lerna-angular-cli-monorepo/packages/demo-app-main/node_modules/@angular/compiler/bundles/compiler.umd.js:24553:41)
at _getNgModuleMetadata (/home/dfbaskin/dev/lerna-angular-cli-monorepo/packages/demo-app-main/node_modules/@angular/compiler-cli/src/ngtools_impl.js:138:31)
at _extractLazyRoutesFromStaticModule (/home/dfbaskin/dev/lerna-angular-cli-monorepo/packages/demo-app-main/node_modules/@angular/compiler-cli/src/ngtools_impl.js:109:26)
at /home/dfbaskin/dev/lerna-angular-cli-monorepo/packages/demo-app-main/node_modules/@angular/compiler-cli/src/ngtools_impl.js:129:27
at Array.reduce (native)
at _extractLazyRoutesFromStaticModule (/home/dfbaskin/dev/lerna-angular-cli-monorepo/packages/demo-app-main/node_modules/@angular/compiler-cli/src/ngtools_impl.js:128:10)
at Object.listLazyRoutesOfModule (/home/dfbaskin/dev/lerna-angular-cli-monorepo/packages/demo-app-main/node_modules/@angular/compiler-cli/src/ngtools_impl.js:53:22)
at Function.NgTools_InternalApi_NG_2.listLazyRoutes (/home/dfbaskin/dev/lerna-angular-cli-monorepo/packages/demo-app-main/node_modules/@angular/compiler-cli/src/ngtools_api.js:91:39)
at AotPlugin._getLazyRoutesFromNgtools (/home/dfbaskin/dev/lerna-angular-cli-monorepo/packages/demo-app-main/node_modules/@ngtools/webpack/src/plugin.js:207:44)
at _donePromise.Promise.resolve.then.then.then.then.then (/home/dfbaskin/dev/lerna-angular-cli-monorepo/packages/demo-app-main/node_modules/@ngtools/webpack/src/plugin.js:443:24)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
The error indicates that the compiler is picking up the @angular/core
component from the "three" example rather than using the one from the main project (which I believe leads to duplicate instances of core definitions).
To work around the issue, you must remove the @angular/core
directory from the node_modules
path in the "three" example.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.