uzairfarooq / arrive

Watch for DOM elements creation and removal
MIT License
869 stars 99 forks source link

Use with webpack #42

Closed biscoe916 closed 8 years ago

biscoe916 commented 8 years ago

Would love to be able to use this with webpack. Is that possible?

sstefoss commented 8 years ago

@biscoe916 It is:

  1. npm install arrive --save
  2. in module.loaders add this: { test: require.resolve('arrive'), loader: 'imports?this=>window' } so that it can inject the window object in the module (this was the problem with webpack + arrive)
  3. from your code require('arrive')

Don't forget to install https://github.com/webpack/imports-loader

If there is a problem with jquery you might need to use ProvidePlugin too:

new webpack.ProvidePlugin({ $: 'jquery', jQuery: 'jquery', 'window.jQuery': 'jquery', 'window.$': 'jquery' })

uzairfarooq commented 8 years ago

I'm going to close as it seems like it's possible. If there's an issue you can reopen it.