Closed happyvig closed 4 years ago
Could you try again with imports-loader@0.7.0
?
Any updates on this problem? Did it work with import-loader@0.7.0?
I have a similar problem in importing angularjs 1.5.11, whereas the angular script from node_module is as follows, and window is not defined when webpack bundles the file.
(function(window){ //angular code })(window) <-- this is not defined when webpack bundles the file.
even when webpack.config.target = 'web'
Can anyone shed some light on this issue?
same issue here
tryed to require ("window") as well but it seems i cant mock window as a module
even with target: 'web'
trouble is actual
Is there a way to not to comment the imports and make it work?
Fixed
Hi., I am trying to access window object inside main.js file by injecting it from index.js via imports-loader syntax and webpack-ing it.
index.js
Tried this : require('imports?global=window!./main.js');
Tried this: require('imports?this=>window!./main.js');
Tried this : require('imports?global=>window!./main.js');
main.js
webpack.config.js