Open BrainCrumbz opened 2 years ago
Also, if it can help: at least in our project, the issue does not show up when we stick to versions:
that is: we actually have HTML files in src
subfolder, we have root
attribute set in vite.config.js
, and yet injection works
Seems like htmlName
on transform should take root
into account because then it never matches any page's template
.
Go from
const htmlName = path__default.relative(process.cwd(), excludeBaseUrl);
to something like
const cwd = viteConfig.root ?? process.cwd();
const htmlName = path__default.relative(cwd, excludeBaseUrl);
Hi there and thanks for this plugin.
Just for some context: our page templates are normally served and data-injected by an express.js app. We started to use this plugin so that page templates could also be tested locally in dev environment with a fast turnaround. Instead of actually going through the server, they are served and hot-reloaded by vitejs dev server, and instead of DB data, there are some dummy data injected by this plugin.
In order to have a repro project, we cloned your MPA playground project and made some changes to show the issue. The main changes are to move both HTML files from root folder to
src
subfolder and then specifyroot: 'src',
invite.config.ts
.Here's the actual issue description:
Steps to reproduce
What should happen
hello world from ...
, and so on)What actually happens
title is not defined
error. It seems like injection is not working correctlyVersions