我使用ui5-cli工具创建了项目。我将外部 js 库添加到我的项目中。ui5 serve
命令启动ui5-server,它正在映射 ui5 库文件夹,因为/resource.
我需要将resource/libs
文件夹映射到项目中的另一个位置。
如何为映射/路由配置ui5-server代理设置?
我的 package.json 文件:
{
"name": "openui5-sample-app",
"version": "0.2.0",
"description": " ",
"private": true,
"scripts": {
"start": "ui5 serve",
"lint": "eslint webapp",
"karma": "karma start",
"karma-ci": "rimraf coverage && karma start karma-ci.conf.js",
"watch": "npm run karma",
"test": "npm run lint && npm run karma-ci",
"build": "ui5 build -a --clean-dest",
"build-self-contained": "ui5 build self-contained -a --clean-dest",
"serve-dist": "ws --compress -d dist"
},
"dependencies": {
"@openui5/sap.m": "^1.70.0",
"@openui5/sap.ui.core": "^1.70.0",
"@openui5/themelib_sap_fiori_3": "^1.70.0",
"js-cookie": "^2.2.1"
},
"devDependencies": {
"@ui5/cli": "^1.9.0",
"eslint": "^5.16.0",
"karma": "^4.3.0",
"karma-chrome-launcher": "^3.1.0",
"karma-coverage": "^2.0.1",
"karma-ui5": "^1.1.0",
"local-web-server": "^3.0.7",
"rimraf": "^3.0.0"
}
}
我的 component.js 文件:
jQuery.sap.registerModulePath('libs.js-cookie', '../resources/libs/js.cookie-2.2.1.min');
sap.ui.define([
...,
"libs/js-cookie"
], function(UIComponent, Device, models) {
...
});
我的 yaml 文件:
specVersion: '1.0'
metadata:
name: openui5-sample-app
type: application
resources:
configuration:
propertiesFileSourceEncoding: "UTF-8"