A high-level view of my root src folder:
src
--- assets
------- schemas
--- js
--- jsx
--- shared
I've added this path: assets/schemas to the copyAssets option inside CEP_Config at ./cep.config.ts, and in return, the folder ./src/assets/schemas gets copied to ./dist/cep/assets/schemas.
I have a CEP code that needs to read a JSON file from that schemas folder, and I'm doing it that way:
When working on "dev" mode - i.e. yarn build && yarn dev the script finds the JSON file successfully, however when I package it using the action yarn zxp and then install it(using ExManCmd) it doesn't find the file - and that's because the value of __dirname is different across those two different environments!
Can anyone please provide an example of how to properly copy assets files/directories and use them in all environments("dev"/"prod")?
A high-level view of my root
src
folder: src --- assets ------- schemas --- js --- jsx --- sharedI've added this path:
assets/schemas
to thecopyAssets
option insideCEP_Config
at./cep.config.ts
, and in return, the folder./src/assets/schemas
gets copied to./dist/cep/assets/schemas
.I have a CEP code that needs to read a JSON file from that
schemas
folder, and I'm doing it that way:When working on "dev" mode - i.e.
yarn build && yarn dev
the script finds the JSON file successfully, however when I package it using the actionyarn zxp
and then install it(usingExManCmd
) it doesn't find the file - and that's because the value of__dirname
is different across those two different environments!Can anyone please provide an example of how to properly copy assets files/directories and use them in all environments("dev"/"prod")?