From e9ebe36db72f6bd21d8ecaecc8c1961c4705f25c Mon Sep 17 00:00:00 2001 From: Damien Arrachequesne Date: Fri, 23 Jun 2017 08:17:17 +0200 Subject: [PATCH] [docs] Add an example with ES6 import in the README (#1138) --- README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3d13652a5..d053f84fe 100644 --- a/README.md +++ b/README.md @@ -26,9 +26,16 @@ serve the file `socket.io.js` found in the `dist` folder. ``` +```js +// with ES6 import +import io from 'socket.io-client'; + +const socket = io('http://localhost'); +``` + A slim build (without `JSON3`, a JSON polyfill for IE6/IE7, and `debug`) is also available: `socket.io.slim.js`. -Socket.IO is compatible with [browserify](http://browserify.org/). +Socket.IO is compatible with [browserify](http://browserify.org/) and [webpack](https://webpack.js.org/) (see example [there](https://github.com/socketio/socket.io/tree/2.0.3/examples/webpack-build)). ### Node.JS (server-side usage)