thlorenz / browserify-shim

📩 Makes CommonJS incompatible files browserifyable.
MIT License
933 stars 87 forks source link

shim jquery #165

Closed aschwersenz closed 9 years ago

aschwersenz commented 9 years ago

In the docs it says here https://github.com/thlorenz/browserify-shim#3-provide-browserify-shim-config that "The above includes ./js/vendor/jquery.js (relative to the package.json) in the bundle and exports window.$.", so in my understanding the following should work:

I have a jquery-2.1.4.min.js in a folder ./assets/vendor/ I'm adding this code to my package.json

  "browserify": {
    "transform": [ "browserify-shim" ]
  },
  "browserify-shim": {
    "./assets/vendor/jquery-2.1.4.min.js": "$"
  }

_ I have a js file with console.log(window.$)

But when I'm running browserify with this configuration jquery gets not included in my bundle and the console.log() returns undefined.

Why? Am i missing something?

bendrucker commented 9 years ago

Can you post the JS where jQuery is required?

aschwersenz commented 9 years ago

Never mind, I completely misunderstood what browserify shim is doing. Got it now :)