question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

jQuery via ProvidePlugin issue

See original GitHub issue

Hello, after this commit https://github.com/JeffreyWay/laravel-mix/commit/6e1ec3dcd4c3f4408c4ee119d70a1eb7ce6d450e I get error when compiling my assets.

The problem is that I do not use jquery but for example in Dropzone.js is this code.

if (typeof jQuery !== "undefined" && jQuery !== null) {
    jQuery.fn.dropzone = function(options) {
      return this.each(function() {
        return new Dropzone(this, options);
      });
    };
  }

so webpack require jquery but this ended with error.

Error:

Can't resolve 'jquery' in 'C:\xampp\htdocs\Moje\WEBSITES\VueShop\node_modules\dropzone\dist'

What about some provideJquery() function added to Laravel Mix for these who need this, or maybe there is other better solution.

Maybe is problem with Dropzone.js, how they determine if there is Jquery.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

15reactions
QWp6tcommented, Jan 19, 2017

I suggest using the following API:

mix.autoload({  // or Mix.autoload() ?
  'jquery': ['$', 'window.jQuery', 'jQuery'],
  'tether': ['window.Tether', 'Tether'],
});

Where the key is the node module and the value is an array of vars to reference it.

0reactions
shimulsqlcommented, Mar 26, 2021

I suggest using the following API:

mix.autoload({  // or Mix.autoload() ?
  'jquery': ['$', 'window.jQuery', 'jQuery'],
  'tether': ['window.Tether', 'Tether'],
});

Where the key is the node module and the value is an array of vars to reference it.

Thanks man

Read more comments on GitHub >

github_iconTop Results From Across the Web

ProvidePlugin not working with jquery - webpack
using thius set up i am unable to access my $ - jquery in console menu. enter image description here. any idea why...
Read more >
ProvidePlugin - webpack
Whenever the identifier is encountered as free variable in a module, the module is loaded automatically and the identifier is filled with the...
Read more >
jQuery via ProvidePlugin issue #96 - laravel-mix ... - GitHub
Hello, after this commit 6e1ec3d I get error when compiling my assets. The problem is that I do not use jquery but for...
Read more >
JQuery in webpack.ProvidePlugin it doesn't work! - Vue Forum
Hi folk !! I am trying to establish JQuery in all my project through ProvidePlugin but it does not work, what I really...
Read more >
$ is not defined - Jquery not found - Laracasts
In my Laravel project (laravel 5.6) I installed Jquery from npm. Then I added it to webpack.mix.js. ... I am using my custom...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found