New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"$ is undefined" with .autoProvidejQuery() and jQuery plugin #52
Comments
The
and include it in the entry. |
Hi guys! I know the problem for Encore
// ...
autoProvideVariables({
'window.jQuery': 'jquery'
}) There was a PR to add this to @kcivey You may have been having the same issue... but I would need a bit more code and the error details to know for sure :). |
It works. Thanks for your help |
This PR was merged into the master branch. Discussion ---------- Re-adding window.jQuery to autoProvidejQuery By adding `window.jQuery` to `autoProvidejQuery()`, it caused problems by making `window.jQuery = require('jquery')` not work (#32). But, *not* having it causes other obvious problems (see #52). This re-adds `window.jQuery` back. As a fix, we would document exposing jQuery as a global variable by doing this: ```js global.$ = global.jQuery = require('jquery'); ``` ping @alOneh Commits ------- 9653f1e re-adding window.jQuery to autoProvidejQuery
Node: 8.7.0 same problem here with Bootstrap 3.3.7 and on page, arbitrary jQuery stuff.
|
I'm trying to use the "foundation-datepicker" package and getting "TypeError: $ is undefined".
app/Resources/js/app.js
:.autoProvidejQuery()
is enabled inwebpack.config.js
..autoProvidejQuery()
works with other jQuery-dependant packages, but when I add this one, it gives the error.Could it be something in the package? According to the browser profiler, the guilty lines in
foundation-datepicker.js
are:What should I do? Sorry if this is not very webpack-encore specific.
The text was updated successfully, but these errors were encountered: