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

Allow “import”ing view engines. #4593

Closed
issuefiler opened this issue May 17, 2021 · 1 comment
Closed

Allow “import”ing view engines. #4593

issuefiler opened this issue May 17, 2021 · 1 comment
Labels

Comments

@issuefiler
Copy link

express/lib/view.js

Lines 80 to 81 in 5c4f3e7

// default engine export
var fn = require(mod).__express

I import view engines, configure them with the imported instances,

then Express requires them, creating new clones of them, and they, the require’d instances that are in use, end up unconfigured.

See eta-dev/eta#113.

@dougwilson
Copy link
Contributor

Hi @issuefiler Express will only require a view module if you didn't provide your existing instance to Express. If the view engine you are importing and configuring relies of some kind of state to be maintained, it is recommended to provide the view engine instance to Express directly instead of relying on the auto-require feature.

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

No branches or pull requests

2 participants