`imports?window.jQuery=jquery` doesn't capture window
See original GitHub issueThe expression imports?window.jQuery=jquery!angular
generates the following
/*** IMPORTS FROM imports-loader ***/
var window = (window || {});
window.jQuery = require("jquery");
require('./angular');
When webpack wraps this in a function expression, the window
referenced in the initialization of the localwindow
is the local window
rather than the global window
. This is fine for contained modules, but in this case the module is just a stub that loads another module where the private window
isn’t visible.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:5
- Comments:5 (1 by maintainers)
Top Results From Across the Web
javascript - JQuery - $ is not defined - Stack Overflow
First you need to make sure that jQuery script is loaded. This could be from a CDN or local on your ...
Read more >Prism
Prism is a lightweight, extensible syntax highlighter, built with modern web standards in mind. It's used in millions of websites, including some of...
Read more >Using Web Workers - Web APIs - MDN Web Docs
A worker is an object created using a constructor (e.g. Worker() ) that runs a named JavaScript file — this file contains the...
Read more >Using Cypress - Cypress Documentation
Cypress commands yield jQuery objects, so you can call methods on them. ... How do I prevent the application from opening a new...
Read more >How can I load jQuery in LWC? - Salesforce Stack Exchange
So if you try to use it inside the component, you'll be able to write something like $('input') , but window.jQuery in developer...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@cdauth this happens because of javascript hoisting. this line:
var window = (window || {});
is interpreted asvar window; window = (window || {});
so you don’t get the global window varaible.you can solve it with some hacking:
imports-loader?window=>global&window.jQuery=>jquery!angular
orimports-loader?windowTemp=>window&windowTemp.jQuery=>jquery!angular
@cap-Bernardito thanks for your last comment. There is a little typo in it which you might want to correct. “additionalCode”
Thank you.