Skip to content

Latest commit

 

History

History
13 lines (9 loc) · 564 Bytes

autoloading.md

File metadata and controls

13 lines (9 loc) · 564 Bytes

Autoloading

Webpack offers the necessary facilities to make a module available as a variable in every other module required by webpack. If you're working with a particular plugin or library that depends upon a global variable, such as jQuery, mix.autoload() may prove useful to you.

Consider the following example:

mix.autoload({
    jquery: ['$', 'window.jQuery']
});

This snippet specifies that webpack should prepend var $ = require('jquery') to every location that it encounters either the global $ identifier, or window.jQuery. Nifty!