-
Notifications
You must be signed in to change notification settings - Fork 21
Closed
ui5-community/ui5-ecosystem-showcase
#848Description
Hi,
I want to use zod
along with the UI5. Therefore, I tried to go with the exercise 4.
What steps have I done?
- Installed
zod
:npm install zod --save-dev
(also tried as a normal dependency, not a dev one, but no difference). - Installed
ui5-tooling-modules
:npm install ui5-tooling-modules --save-dev
- Edited the
ui5.yaml
as described in the exercise (full contents of the file below). - Imported
zod
into a TypeScript file. - Started the project with
npm run start
.
devDependencies
in package.json
:
"devDependencies": {
"@babel/eslint-parser": "7.14.7",
"@sap-ux/eslint-plugin-fiori-tools": "^0.2.0",
"@sap-ux/ui5-middleware-fe-mockserver": "2",
"@sap/ux-ui5-tooling": "1",
"@sapui5/ts-types-esm": "~1.108.22",
"@typescript-eslint/eslint-plugin": "^5.59.0",
"@typescript-eslint/parser": "^5.59.0",
"@ui5/cli": "^3.0.0",
"eslint": "7.32.0",
"eslint-plugin-fiori-custom": "2.6.7",
"typescript": "^5.1.6",
"ui5-tooling-modules": "^3.0.7",
"ui5-tooling-transpile": "^3.2.0",
"zod": "^3.22.2"
},
ui5.yaml
:
# yaml-language-server: $schema=https://sap.github.io/ui5-tooling/schema/ui5.yaml.json
specVersion: "3.1"
metadata:
name: XXX
type: application
server:
customMiddleware:
- name: ui5-tooling-modules-middleware
afterMiddleware: compression
- name: fiori-tools-proxy
afterMiddleware: compression
configuration:
ignoreCertError: true # If set to true, certificate errors will be ignored. E.g. self-signed certificates will be accepted
ui5:
path:
- /resources
- /test-resources
url: https://ui5.sap.com
backend:
- path: /sap
url: XXX
client: "XXX"
destination: XXX
- name: fiori-tools-appreload
afterMiddleware: compression
configuration:
port: 35729
path: webapp
delay: 300
- name: ui5-tooling-transpile-middleware
afterMiddleware: compression
configuration:
debug: true
excludePatterns:
- /Component-preload.js
- name: fiori-tools-preview
afterMiddleware: fiori-tools-appreload
configuration:
component: XXX
ui5Theme: sap_horizon
builder:
customTasks:
- name: ui5-tooling-modules-task
afterTask: replaceVersion
configuration:
addToNamespace: true
- name: ui5-tooling-transpile-task
afterTask: replaceVersion
configuration:
debug: true
zod
usage:
import { z } from "zod";
export const oCommiAreas = z.object({
Area: z.string().max(30),
Arbpl: z.string().max(8),
AreaDescr: z.string().max(40),
Target: z.number().int(),
});
export type CommiAreas = z.infer<typeof oCommiAreas>;
I get the following error in the browser's Dev Tools:
Uncaught (in promise) ModuleError: Failed to resolve dependencies of '.../controller/MainView.controller.js'
The sources of the page in the Dev Tools look like this. There is no zod.js
file anywhere.
According to zod.dev, zod has "zero dependencies" and "works in Node.js and all modern browsers".
Could you please help me with this issue?
Metadata
Metadata
Assignees
Labels
No labels