How to create a global variable in javascript (using webpack) -
i'm using react js webpack, webpack-dev-server , ecmascript 6. have undeclared variable in file named data.js. however, cannot modify data.js file since standard. there way can make variable global js file? tried declaring window.myvarname
in file data.js referenced using import
statement still giving error uncaught referenceerror: myvarname not defined
define object in file below
var data={ myvarname:"" };
and call want
data.myvarname;
Comments
Post a Comment