bookmark

javascript - Accessing global variable after webpack build - Stack Overflow


Описание

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;

тэги

Пользователи данного ресурса

  • @jil

Комментарии и рецензии