Skip to content
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

Remove jQuery autoloader #585

Closed
richardsweeney opened this Issue Mar 17, 2017 · 3 comments

Comments

Projects
None yet
3 participants
@richardsweeney
Copy link

richardsweeney commented Mar 17, 2017

Mix is AMAZEBALLS! Such a simple, yet powerful api. A massive thanks to you Jeffrey for the resource!

I'm trying to use mix for WordPress dev where jQuery is (almost) always loaded in the frontend.

I'd very much like to remove the autoloader for jQuery which is found in webpack.config.js but I can't quite figure out if this is possible to do in webpack.mix.js.

I realize I can just remove the lines below, but I'd ideally like to avoid that if at all possible.

new webpack.ProvidePlugin(Mix.autoload || {
    jQuery: 'jquery',
    $: 'jquery',
    jquery: 'jquery'
}),

laravel-mix v. 0.8.8
npm v. 4.1.2

@devcircus

This comment has been minimized.

Copy link
Contributor

devcircus commented Mar 17, 2017

Looks like that plugin first looks for mix.autoload before it sets up the aliases that will load jquery. So would it be possible to just add mix.autoload({}) to your mix.js file to prevent this?

mix.js('resources/assets/js/app.js', 'public/js')
   .sass('resources/assets/sass/app.scss', 'public/css')
   .autoload({});

I haven't tested this, just thought it may work.

@JeffreyWay

This comment has been minimized.

Copy link
Owner

JeffreyWay commented Mar 17, 2017

Yeah you can do mix.autoload({}), but I think we might still want to remove the jQuery reference entirely.

@richardsweeney

This comment has been minimized.

Copy link
Author

richardsweeney commented Mar 20, 2017

Many thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.