我的目标:使用一个尚未由JHipster导入的图标
我的尝试:使用以下代码在app.vendor.ts文件中手动添加图标GrinHearts,然后运行yarn run webpack:build命令
/* after changing this file run 'yarn run webpack:build' */
/* tslint:disable */
import '../content/css/vendor.css';
// Imports all fontawesome core and solid icons
import { library } from '@fortawesome/fontawesome-svg-core';
import {
faUser,
faSort,
faSync,
faEye,
faBan,
faTimes,
faArrowLeft,
faSave,
faPlus,
faPencilAlt,
faBars,
faThList,
faUserPlus,
faRoad,
faTachometerAlt,
faHeart,
faList,
faBell,
faBook,
faHdd,
faFlag,
faWrench,
faClock,
faCloud,
faSignOutAlt,
faSignInAlt,
faCalendarAlt,
faSearch,
faTrashAlt,
faAsterisk,
faTasks,
faHome,
faGrinHearts
} from '@fortawesome/free-solid-svg-icons';
// Adds the SVG icon to the library so you can use it in your page
library.add(faUser);
library.add(faSort);
library.add(faSync);
library.add(faEye);
library.add(faBan);
library.add(faTimes);
library.add(faArrowLeft);
library.add(faSave);
library.add(faPlus);
library.add(faPencilAlt);
library.add(faBars);
library.add(faHome);
library.add(faThList);
library.add(faUserPlus);
library.add(faRoad);
library.add(faTachometerAlt);
library.add(faHeart);
library.add(faList);
library.add(faBell);
library.add(faTasks);
library.add(faBook);
library.add(faHdd);
library.add(faFlag);
library.add(faWrench);
library.add(faClock);
library.add(faCloud);
library.add(faSignOutAlt);
library.add(faSignInAlt);
library.add(faCalendarAlt);
library.add(faSearch);
library.add(faTrashAlt);
library.add(faAsterisk);
library.add(faGrinHearts);
// jhipster-needle-add-element-to-vendor - JHipster will add new menu items here
我的问题:我收到此错误
/src/main/webapp/app/vendor.ts中的ERROR (41,5):模块'“
/ node_modules / @ fortawesome / free-solid-svg-icons / index”'没有导出的成员'faGrinHearts'。有人可以帮我吗?
谢谢!
答案 0 :(得分:3)
您需要更新@fortawesome/free-solid-svg-icons
软件包,FaGrinHearts
中不包含v5.1.0-8
图标,而仅包含在v5.1.0+
中。我建议使用最新版本v5.2.0
。您可以查看npmjs