From 18f95bcf711e7e6188dcb5853ae869efde61ee6b Mon Sep 17 00:00:00 2001 From: Erick Wilder Date: Wed, 10 Jan 2018 16:25:28 +0100 Subject: [PATCH] docs(readme) Add webpack section to README file ### 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 --- README.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/README.md b/README.md index 9120e3a7..fc927153 100644 --- a/README.md +++ b/README.md @@ -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 ---------------