question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bug with variable scoping

See original GitHub issue

There seems to be a major issue with the scoping of variables, that are not available for all files.

Unfortunately I’m not sure which component of pug is the root cause for this.

I have prepared a small sample here: https://github.com/Tiliavir/pug-variable-scope-issue

Simply CO, run npm run build and check the output vs. the resulting HTML. Subtitle should be empty in most files, but are used in files where subtitle is not specified.

My output is:

PS C:\pug-variable-scope-issue> npm run build

> var-issue@1.0.0 build C:\pug-variable-scope-issue
> node -v && npm -v && gulp

v6.9.1
3.10.8
[10:16:53] Using gulpfile C:\pug-variable-scope-issue\
[10:16:53] Starting 'default'...
[10:16:53] Finished 'default' after 17 ms
1 - undefined
2 - sub2
3 - undefined
4 - undefined
5 - sub5
6 - undefined

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
jamencommented, Dec 2, 2016

@Tiliavir Hey. Yeah, I can merge these PRs and make a new release.

0reactions
Tiliavircommented, Dec 3, 2016

Fixed! Works like a charm …

Read more comments on GitHub >

github_iconTop Results From Across the Web

Variable Scope | Fix error: 'yourVariable' was not declared in ...
In this lesson, we are going to talk SUPER BASICALLY about variable scope. There are so many technical details we could dive into,...
Read more >
Debug scope bug - Visual Studio Feedback
pngRecently, in a class for my Unity project, I encountered a strange bug where debug mode claims a variable is out of scope...
Read more >
Fixing Variable Scope Issues with ECMAScript 6 - A List Apart
Scope is the area in which a variable is known. Take a look at the following code: var myVar = 1; function setMyVar()...
Read more >
Safari bug with block scoped variables? - Stack Overflow
Might need to point out that function declarations are block scoped in strict mode but variables declarations aren't.
Read more >
variable scope bug · Issue #1434 · traefik/yaegi - GitHub
The following program sample.go triggers an unexpected result package main import "fmt" func main() { s := make([]map[string]string, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found