Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vite support #16

Open
rtritto opened this issue Jul 29, 2024 · 3 comments
Open

Vite support #16

rtritto opened this issue Jul 29, 2024 · 3 comments

Comments

@rtritto
Copy link

rtritto commented Jul 29, 2024

import express from 'express'
import swig from 'free-swig'

const app = express()

// cache is false
const swigOptions = {
  cache: process.env.NODE_ENV === 'production' ? 'memory' : false
}

// Swig generates the TypeError
const swigEngine = new swig.Swig(swigOptions)

Output

TypeError: Cannot read properties of undefined (reading 'file')
    at Object.eval [as tpl] (eval at precompile (C:\<MY_PROJECT>\node_modules\free-swig\lib\swig.js:539:13), <anonymous>:183:2181)
    at compiled (C:\<MY_PROJECT>\node_modules\free-swig\lib\swig.js:666:18)
    at C:\<MY_PROJECT>\node_modules\free-swig\lib\swig.js:606:20
    at C:\<MY_PROJECT>\node_modules\free-swig\lib\swig.js:737:9
    at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read/context:68:3)

Related vituum/vituum#52

@steevhise
Copy link

steevhise commented Jul 29, 2024

i don't know enough about Express or Vite to fix this with the time I have. Care to offer a pull request?
you might want to look at this example if you havent already https://github.com/steevhise/free-swig/blob/main/examples/express/server.js

Also, this will likely not be where support for the module happens as I'm not at Freecycle any more. and my replacement there is asleep at the wheel. check out my fork of it. my latest release comes from there.
https://github.com/steevhise/free-swig

@rtritto
Copy link
Author

rtritto commented Jul 30, 2024

Waiting an answer from vituum/vituum#52 where a plugin for Vite should be created.
We can support or open a PR to Vituum.
Some examples: https://github.com/vituum/vituum/tree/main/examples
Next step is maybe to link the Vite plugin for swig in free-swig.

@rtritto
Copy link
Author

rtritto commented Aug 3, 2024

No plan to create Vite plugin for swig: vituum/vituum#52 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants