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.myvarnamein 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

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -