Code Monkey home page Code Monkey logo

lerna-angular-cli-monorepo's People

Contributors

dfbaskin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

papirosko simone

lerna-angular-cli-monorepo's Issues

Error lazy-loading library module

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"
  },

Build is resolving to wrong @angular/core component

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.