Open ketan opened 1 week ago
Hey @ketan! 👋🏻
Any reason to use ejs
instead of the backed-in Edge
template engine?
As per your issue, you are trying to compile your ejs
file with Vite.
Vite is only used to compiled your frontend assets. Use directly node to compile your ejs
like we are doing for edge
.
// When using Edge
router.get('/', async ({ view }) => {
return view.render('welcome')
})
Hi @RomainLanz - thanks for responding. I'm looking to do some templating in the frontend, not looking to do this via backend. EJS is what I'm familiar with, and trying to avoid react/vue etc.
Gotcha. You want to use ejs
with client-side JavaScript to make it easier to write vanilla components.
Doing so, I still believe you don't need to compile your template through Vite if you are purely client-side. If you know what you are doing you can try to add a Vite plugin to support ejs
files: https://www.npmjs.com/package/vite-plugin-ejs
Package version
@adonisjs/vite@3.0.0, vite@5.3.1
Describe the bug
I'm looking to do some frontend templating using
ejs
, to avoid react etc. and keep things simple (or so I thought).As part of my code that runs in the browser I've raw imported the EJS file
The above seems to compile just fine when running via
node ace build
ornode ace serve --hmr
. However runningnode ace test
yields the following error:Reproduction repo
https://github.com/ketan/paragliding-meshmap