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.

How are multiple global variables specified?

See original GitHub issue

❔ Question

Using the --global flag, I was able to denote that a variable belongs to the global context. However, I haven’t had any luck getting this to work with multiple variables (tried comma delimiters which didn’t work for example).

🌍 Your Environment

Software Version(s)
Parcel 1.12.4
Node v13.3.0
npm 6.13.2
Operating System Linux

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jeremyongcommented, Dec 11, 2019

Ok that clears up exactly what’s happening thanks. I did indeed misunderstand the docs here.

Cheers

0reactions
mischniccommented, Dec 11, 2019

--global foo does this when you invoke parcel on this file

module.exports = {something: 1234}

and then use the produced bundle:

<script src="dist/bundle-from-parcel.js"></script>
<script>
	console.log(foo) // == {something: 1234}
</script>
Read more comments on GitHub >

github_iconTop Results From Across the Web

Python - Easiest way to define multiple global variables
I am trying to look for an easy way to define multiple global variables from inside a function or class.
Read more >
How to declare global variables in Python - GoLinuxCloud
In this tutorial we will learn about different terminologies related to declaring variables (local and global) in Python.
Read more >
Global Variables are Evil
A global variable is a variable defined in the 'main' program. ... Modifying global variables in a function is considered poor programming practice....
Read more >
Python Global Variables – How to Define a ... - freeCodeCamp
The way to change the value of a global variable inside a function is by using the global keyword:
Read more >
Global variables - Richard Fitzpatrick
It is possible to define variables which are global in extent: such variables are recognized by all the functions making up the program,...
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