Skip to content

Commit

Permalink
docs(readme) Add webpack section to README file
Browse files Browse the repository at this point in the history
### Rationale

It might not be clear enough to library users (especially those using wrapper libraries) that webpack has to know how to resolve
symbols that are not fully compatible with ES6 import
  • Loading branch information
erickwilder committed Jan 10, 2018
1 parent 856f5ad commit 18f95bc
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,29 @@ noUiSlider.create(slider, {
});
```

Webpack
-------
In order to use this with webpack, the easiest way to work with it is by using the [`ProvidePlugin`](https://webpack.js.org/plugins/provide-plugin/):

```javascript
// webpack.config.js
var webpack = require('webpack');
...
plugins: [
new webpack.ProvidePlugin({
noUiSlider: 'nouislider'
})
]
...
```

If you're using ES6 imports, a simple [import with side effect](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import#Import_a_module_for_its_side_effects_only)
is enough:

```
import 'nouislider';
```

Browser support
---------------

Expand Down

0 comments on commit 18f95bc

Please sign in to comment.