如何在webpack.config.js中配置primeng

时间:2017-04-06 07:32:40

标签: angular webpack primeng

我是新的Angular 2和primeNG以及我正在处理使用webpack服务器配置的项目,现在我想在我的项目中使用primeng我该怎么做。

我使用npm安装了primeng并在appmodule中导入了primeng模块,然后尝试使用

<p-dropdown [options]="cities" [(ngModel)]="selectedCity"></p-dropdown>

显示错误,如

./~/primeng/components/accordion/accordion.js
Module not found: Error: Can't resolve '@angular/animations' in \node_modules\primeng\components\accordion'
 @ ./~/primeng/components/accordion/accordion.js 13:19-49
 @ ./~/primeng/primeng.js
 @ ./src/app/app.component.ts
 @ ./src/app/app.module.ts
 @ ./src/app/index.ts
 @ ./src/main.browser.ts
 @ multi (webpack)-dev-server/client?http://localhost:3000 ./src/main.browser.ts

./~/primeng/components/confirmdialog/confirmdialog.js
Module not found: Error: Can't resolve '@angular/animations' \node_modules\primeng\components\confirmdialog'
 @ ./~/primeng/components/confirmdialog/confirmdialog.js 13:19-49
 @ ./~/primeng/primeng.js
 @ ./src/app/app.component.ts
 @ ./src/app/app.module.ts
 @ ./src/app/index.ts
 @ ./src/main.browser.ts
 @ multi (webpack)-dev-server/client?http://localhost:3000 

1 个答案:

答案 0 :(得分:0)

看起来像'@ angular / animations'缺失。

您可以通过npm安装:

npm install @ angular / animations --save

Reference

如果以上内容对您不起作用,请尝试使用旧版本的PrimeNg(2.0.3)

npm install primeng@2.0.3 --save

PrimeNG