Closed fredriks closed 7 years ago
Does this PR handle case of injecting multiple globals? For example: import?window.jQuery=jquery,window._=lodash
@korya It does handle multiple globals on window. I've added tests that illustrate various cases.
Great! Thanks!
@sokra What do you think? can it be merged?
It looks like this code change may override some variables which are already exist.
For example i have global / local variable noty
.
import?noty.theme
will be compiled to
var noty = {};
var noty.theme = __webpack_require__(XXX);
which will override my global / local variable noty
that can be used in code
@fredriks, looks like @artyomtrityak is right (disclaimer: I'm looking purely at the code). At the moment you have a specific check for var window
(window || {}
), perhaps that could be changed so it works on all variables?
Aye, good point! I'll update the PR with a more general approach.
looks good for me
Thanks a lot @fredriks!
Released imports-loader@0.7.0
with this. Thanks again @fredriks, this has solved a lot of issues.
import?abc.def.ghi=>1 => var abc = {}; abc.def = {}; abc.def.ghi = 1;
import?window.jQuery=jquery => var window = {}; window.jQuery = require("jquery");
Fixes #28, fixes #22, fixes #32