如何在从 Angular cli 生成的 Angular 应用程序中加载Globalize库以及 CLDR 数据。当我执行以下步骤时:
npm install globalize cldr-data
import {Globalize} from 'globalize';
在app.component.ts
ng serve
我收到此错误:
Can't resolve 'cldr' in '/Users/temp-user/cldr-app/node_modules/globalize/dist'
@ ./~/globalize/dist/globalize.js 22:2-25:14
@ ./~/globalize/dist/node-main.js
@ ./src/app/app.component.ts
@ ./src/app/app.module.ts
@ ./src/main.ts
@ multi webpack-dev-server/client?http://localhost:4200 ./src/main.ts
编辑:
还尝试将其包含scripts
在angular-cli.json
"scripts": [
"../node_modules/cldrjs/dist/cldr.js",
"../node_modules/globalize/dist/globalize.js"
],