Skip to content

Commit

Permalink
Expose jQuery to global object
Browse files Browse the repository at this point in the history
Because in many scenarios, such as when a _.js.erb_ file is rendered, is
needed to have it available globally, in order to avoid the `$ is not
defined` error.

More info:
drgullin/icheck#322 (comment)
https://github.com/webpack-contrib/expose-loader#usage
  • Loading branch information
dgdavid committed Apr 2, 2018
1 parent 32b8abf commit 3c0e51c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ module.exports = {
},
module: {
rules: [
{
test: require.resolve('jquery'),
use: [{
loader: 'expose-loader',
options: '$'
}]
},
{
test: /\.js$/,
exclude: /node_modules/,
Expand Down

0 comments on commit 3c0e51c

Please sign in to comment.