Skip to content

Commit e9ebe36

Browse files
[docs] Add an example with ES6 import in the README (#1138)
1 parent 19f2b19 commit e9ebe36

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

README.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,16 @@ serve the file `socket.io.js` found in the `dist` folder.
2626
</script>
2727
```
2828

29+
```js
30+
// with ES6 import
31+
import io from 'socket.io-client';
32+
33+
const socket = io('http://localhost');
34+
```
35+
2936
A slim build (without `JSON3`, a JSON polyfill for IE6/IE7, and `debug`) is also available: `socket.io.slim.js`.
3037

31-
Socket.IO is compatible with [browserify](http://browserify.org/).
38+
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)).
3239

3340
### Node.JS (server-side usage)
3441

0 commit comments

Comments
 (0)