BlogTroubleshootingBuild
Vendra styles, images or scripts do not load after moving the files, or the build fails
Relative paths and what breaks them, the Content Security Policy that blocks inline scripts and outside resources, the React edition in a sub-folder, and the usual causes of a failed npm run build or npm test.

A page is unstyled, or images and fonts are missing
The built pages link their assets with paths relative to the page: ./assets/css/vendra.min.css, ./assets/img/products/…, and the fonts from ../fonts/ inside the stylesheet. That is what lets dist/ work from disk and from any folder on a host. It also means:
- Move the whole
dist/folder, never a page on its own. A page copied out of the folder has noassets/next to it. - Keep pages and
assets/at the same level. Putting pages in a sub-folder (/shop/index.html) breaks every./assets/link unless you moveassets/with them or rewrite the paths. - If you serve the pages through a template or a CMS,
src/partials/head.hbsandscripts.hbsare where the links are made; adjust them there and rebuild rather than editingdist/by hand.
After an upload, a hard refresh is not needed: the build adds a ?v= query to every asset link, so a new build is never served from the old cache.
A script I added does not run, or an outside image or font does not load
Every built page carries a Content Security Policy meta tag. It allows scripts, styles, images, fonts and connections from the page's own origin only, plus the hashes of the inline scripts the build itself generated, data: URLs for fonts and images, and https://www.openstreetmap.org in frames for the map embeds. The browser reports what it blocks in the console as a policy violation.
- An inline
<script>you added to a page insrc/is hashed automatically at build time, so it runs. The same script pasted into a page indist/is not, and is blocked. Edit the source and rebuild, or put the code in a file underpublic/and link it. - Images, fonts, scripts or analytics from another domain need that domain in the policy. The policy is built in
vite.config.js(thecsparray in thevendraPages()plugin): add the origin toimg-src,font-src,script-srcorconnect-srcand rebuild. Inline event handlers (onclick="…") are never allowed; bind listeners in a script instead. - Sending the policy as a header too (the commented line in
server-config/apache.htaccess) must include the same'sha256-…'sources as the meta tag, or the inline scripts stop. - To build without the policy while you debug, run the build with
VENDRA_CSP=offin the environment. Put it back before going live.
The React edition shows a blank page or 404s in a sub-folder
Built with the default base, the app expects to live at the root of its host and loads /assets/…. Under a sub-folder those paths point at the wrong place. Build with the folder as base, for example npx vite build --base /react/, or set base in react/vite.config.js; the router reads the same value for its own paths. And configure the host to answer unknown paths with index.html (on nginx try_files $uri /index.html;), or a reload on /shop is a 404.
npm run build fails
- Node version. Vendra needs Node.js 20 or newer; check with
node -v. Older versions fail on syntax or on the Vite version inpackage.json. - Dependencies not installed. Run
npm installin the folder that holdspackage.json. For the React edition, install in the parent folder first and then inreact/: it resolves Bootstrap and the engine from the parent. - A Handlebars error names a page. The build assembles
src/*.htmlwith partials and helpers; a partial that does not exist, an unclosed{{#each}}, or a product helper with a demo or category that is not incatalog.jsstops the build with the file name in the message. - A demo key that is not in DEMOS. Setting a page's
demoinpages.jsto a key without an entry inDEMOSofcatalog.jsfails when the page context is built, because the store name is read from it. - Sass warnings about deprecations are expected with Bootstrap 5.3 and are silenced in the config; they are not errors.
npm test or npm run responsive fails straight away
Both drive a real browser through Playwright. The first time, run npx playwright install chromium to download it; without that the script stops before opening a page. npm test runs against dist/, so build first. In react/, npm test builds and serves the app itself, but it also needs the Chromium download.
If none of this matches, write to [email protected] with the page, your browser or Node version, and the exact message; support covers reproducible defects in Vendra while your licence is active.