Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PrimeNG (PrimeUI) + Webpack + angular2 + typescript

Is here anybody who know how to make PrimeNG under Webpack working?

We have project on angular2-webpack-starter but the PrimeNG have todo just with System.js loader

I get the point when the PrimeNG is loading fine, but i can get success with PrimeUI library... let say for example file primeng/components/togglebutton/togglebutton.ts

error TS2503: Cannot find namespace 'PrimeUI'.

I even tried magic formula with declare in ...togglebutton.ts

declare var PrimeUI:any;

and in my webpack.config

plugins: [ 
  new webpack.ProvidePlugin({
    PrimeUI: 'primeui',
  })
  .
  .
 ],

but if I try something like

import * as PrimeUI from 'primeui';

error TS2307: Cannot find module 'primeui'.

I just remind I did npm install primeui and the primeui is present in node_modules with all dependencies

like image 475
m1uan Avatar asked Feb 29 '16 12:02

m1uan


1 Answers

If you are getting error on :

import * as PrimeUI from 'primeui';

You need to do

declare module 'primeui' {
    var foo:any;
    export = foo
}
like image 135
basarat Avatar answered Nov 28 '22 13:11

basarat