bookmark

javascript - Accessing global variable after webpack build - Stack Overflow


Description

When webpack bundles your javascript it wraps all of your individual files/modules in functions so they are no longer run in the global scope, therefore if you want to make a variable global you have to explicitly set it on the window object, i.e.

window.a = 1;

Preview

Tags

Users

  • @jil

Comments and Reviews