0

I have a question.

I'm new to webpack4 and I was told to apply it into project which is a .Net MVC & AngularJS 1.6 web app. Project has some imperfections which causes some problems with reusing some functionality inside angular files. So my first step is to bundle all code using webpack4, use babel etc. Yet the problem is in couple .js files like angular services, controllers, plain .js files previous devs used window object. After making couple entries (each entry for app part - service-bundle.js, controller-bundle.js etc) functions, variables which are assigned to window object does not work anymore. My question is - is it possible to some kind of "make" window object common for all entries so whenever new variable or function was assigned to window object in any file will be "visible" and treated as some kind of shared module?

Right now I have to keep files with window.function/variable separate from webpack entries and imported as standalone files.

Cheers

thoudy
  • 1
  • 1
  • 1
    Angular 1.6? Inject and use`$window` instead of `window` in anything that can use angular's DI – bcr Sep 14 '18 at 14:05
  • Yes, thank you, that will partially solve my problem only inside angular files. Yet there are plain .js files (no services, no controllers) that use window.variable/method in which $window cannot be injected – thoudy Sep 14 '18 at 14:27
  • Possible duplicate of [How do I access the global object (window) using webpack?](https://stackoverflow.com/questions/29844893/how-do-i-access-the-global-object-window-using-webpack) – Pop-A-Stash Sep 14 '18 at 14:49

0 Answers0