MeetmeLeave / ng-canvas-gauges

Angular2 component wrapper for the canvas-gauges library written by @Mikhus(https://github.com/Mikhus/canvas-gauges).
MIT License
38 stars 23 forks source link

Errors moving to Angular 5 with AngularCli from a working Angular 4 project #15

Open ste4net opened 6 years ago

ste4net commented 6 years ago

Hello, As in subject i found error moving from Angular 4.2.5 working project to Angular ^5.0.0 in AngularCli. 2 Warnings and 1 Error Error: Uncaught Error: Unexpected value 'GaugesModule' imported by the module 'DashModule'. Please add a @NgModule annotation. Change from import { GaugesModule } from 'ng-canvas-gauges/lib';
to import { GaugesModule } from 'ng-canvas-gauges/src';
generate other errors.

Warnings:

./node_modules/ng-canvas-gauges/node_modules/@angular/core/@angular/core.es5.js
5659:15-36 Critical dependency: the request of a dependency is an expression
 @ ./node_modules/ng-canvas-gauges/node_modules/@angular/core/@angular/core.es5.js
 @ ./node_modules/ng-canvas-gauges/lib/index.js
./node_modules/ng-canvas-gauges/node_modules/@angular/core/@angular/core.es5.js
5675:15-102 Critical dependency: the request of a dependency is an expression
 @ ./node_modules/ng-canvas-gauges/node_modules/@angular/core/@angular/core.es5.js
 @ ./node_modules/ng-canvas-gauges/lib/index.js
msantacruz commented 6 years ago

Same error with Angular ^5.2.0

lostation commented 6 years ago

Same here... solution ?

erickyi2006 commented 6 years ago

for angular 5, it did not build the GaugesModule in the lib. Instead I modified component.js to explicitly include the two sub components

old exports.GaugesModule = require('./lib/gauges-module').GaugesModule; new

exports.RadialGaugeComponent = require('./lib/radial-gauge').RadialGaugeComponent; exports.LinearGaugeComponent = require('./lib/linear-gauge').LinearGaugeComponent;

See also Issue 3 if you want to build in prod mode

updates oops. forgot to mention. after i run the initial build (npm install), i removed the node_modules/ng-canvas-gauges/node_modules. then i proceeded to modify the above.