-
Notifications
You must be signed in to change notification settings - Fork 643
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
Different environment instances share globals #573
Comments
Is the last line a typo? You're reading from the same |
Oh yeah, good catch. Thanks, I edited it. |
I don't have time to look into this and verify it at the moment, but if in fact this is the behavior, IMO it is clearly a bug and should be fixed. Environments should be independent. Also I have no problem with adding |
Just confirming, globals are global to nunjucks -- it's essentially just the exports object from src/globals.js |
Thanks for the quick response. I went ahead and made a PR for the globals. |
Fixed with merge of #574. |
Wanted to see if this was intended behavior. When I call
nunjucks.configure
multiple times and get different Environment instances: if I add a global to the first instance, it will also be tied to any other instance that is created afterwards.Example:
Most people will probably only need one Environment in most cases, but this is something I didn't realize until I ran into it. Also, kind of related and out of curiosity, is there a good reason there's no
removeGlobal
orremoveFilter
method? Thanks!The text was updated successfully, but these errors were encountered: