The below part of blog assumes that you have a basic understanding about ui5-tooling and yarn. If not, then go through UI5 Tooling documentation and yarn documentation.
yarn install
yarn start
to start local development server. Once started you would be able to view your app running in default browser at http://localhost:8080lodash
and momentjs
to our current project. You can do so by running the below commands in your terminal:yarn add lodash
yarn add moment
ui5 > dependencies
section of Package.json
. Lets add that configuration to our Package.json
. Below is how your final Package.json
file should look like.
Tip: You can verify your dependencies usingui5 tree
command in the terminal
ui5.yaml
file. This can be done using UI5 tooling extension project-shim. At the end of your ui5.yaml
file below code should be placed. Since we are adding a project extension, below code should be separated by new line with 3 dashes (- – -)---
specVersion: '2.1'
kind: extension
type: project-shim
metadata:
name: thirdparty # this can be your project shim name
shims:
configurations:
lodash: # name as defined in package.json
specVersion: '2.1'
type: module # Use module type
metadata:
name: lodash
resources:
configuration:
paths:
/resources/thirdparty/lodash/: '' # location where modules are stored
moment: # name as defined in package.json
specVersion: '2.1'
type: module # Use module type
metadata:
name: moment
resources:
configuration:
paths:
/resources/thirdparty/moment/: '' # location where modules are stored
/resources/thirdparty/lodash
will be the location inside dist folder where your modules will be stored. Location inside /resources/
folder can be customized further similar to /resources/<custom_folder_path>/
. Same path will be used in controller
and component
file to import node modules.Component.js
, otherwise it can be required in any controllers file.lodash
and momentjs
for demonstration purpose.ui5.yaml
file after omitting /resources
part. At the end of path NPM package JavaScript file name should be added. For example lodash.js
is the file inside lodash
folder. If you are having confusion with file name you can always build project using yarn build-all
to view folder structure and find file name.npm packages
inside your UI5 projects and make use of amazing third party libraries to build your awesome UI5 applications.You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
13 | |
10 | |
7 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 | |
5 |