Question

I am currently loading socket.io client library through the automatic URL provided:

requirejs.config({
    urlArgs: "b=" + ((new Date()).getTime()),
    baseURL: "/javascripts/",
    paths: {
      /*other libaries here*/
      io: "/socket.io/socket.io"
    },
  shim: {
    "io" : {exports: "io"}
  }
});

This works, however doesn't use mimosa's minifying capabilities as it can't find the local file. It also gives me an annoying error on startup.

2:37:34 - Dependency [[ /socket.io/socket.io ]] for path alias [[ io ]], inside file [[ dr/public/javascripts/common.js ]], cannot be found.
12:37:34 - Dependency [[ io ]], inside file [[ dr/public/javascripts/app.rq.js ]], cannot be found.
12:37:34 - Shim path [[ io ]] inside file [[ dr/public/javascripts/common.js ]] cannot be found.

Is the socket.io.js libary available in the socket.io npm package for example so I can just include it as a filepath? I've also tried installing the socket.io client libary through bower and then including it, but that didn't work properly.

Was it helpful?

Solution

Detailed discussion can be found here:

https://github.com/dbashford/mimosa/issues/338#issuecomment-31974008

In summary:

The problem was that the npm and bower version of socket.io were different; causing weird issues.

Not an ideal solution, but it works for now:

I still wish there was a way to get the file which socket.io automatically provides at /socket.io/socket.io - I mean it must exist somewhere in the node_modules/socket.io folder.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top