The official documentation of socket.io has an example of importing and using socket.io from client-side like this:
index.html
<body>
<script src="/socket.io/socket.io.js"></script>
<script src="https://code.jquery.com/jquery-1.11.1.js"></script>
<script>
$(function () {
var socket = io();
// Some other code in here...
});
</script>
</body>
Now I'm trying to put my js code inside a main.js file (beside index.html in public folder). This is what I do which gives me Unexpected identifier:
main.js
import io from "../socket.io/socket.io.js"
const socket = io()
// Some other code here...
What is the right form of importing socket.io in this case?