Using imjs with AMD loader

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Using imjs with AMD loader

Colin
Hi all,
I am currently trying to use the imjs API in the browser using AMD. Unfortunately it is throwing out some errors that I can't quite figure out, because I thought the dependencies would be resolved automatically.

Here's a boilerplate webpage that I'm using


<html>
<head>
<script src="src/dojo/dojo.js" data-dojo-config="baseUrl: './src'"></script>
<script>

require({
    packages: [
        'dojo',
        'dojox',
        'dijit',
        'imjs'
    ]
},
[
    "imjs/js/im",
], function(im) {
    console.log("Loaded");
});
</script>
</head>
<body>
</body>
</html>

Along with a bower.json (installing into ./src)

{
  "name": "imjs-demo",
  "version": "1.0",
  "dependencies": {
    "dojo": "1.10.1",
    "dojox": "1.10.1",
    "dijit": "1.10.1",
    "imjs": "3.6.1"
  },
  "license": "MIT"
}


When I open the page I get

GET http://localhost/intermine-test/httpinvoke.js 404 (Not Found) dojo.js:325
Uncaught Error: xhrFailed



As a sidenote, I did have this working at one point and I forget what I had setup. If there is any advice on how to fix it again it would be greatly appreciated!

Thanks,
-Colin

_______________________________________________
dev mailing list
[hidden email]
http://mail.intermine.org/cgi-bin/mailman/listinfo/dev
Reply | Threaded
Open this post in threaded view
|

Re: Using imjs with AMD loader

Colin
Just as a follow up, I am able to use requirejs as the AMD loader and I can do some testing for now. It would be ideal if I could get the dojo AMD loader working for this eventually though.


Thanks,
-Colin

On Wed, Oct 29, 2014 at 10:22 AM, Colin <[hidden email]> wrote:
Hi all,
I am currently trying to use the imjs API in the browser using AMD. Unfortunately it is throwing out some errors that I can't quite figure out, because I thought the dependencies would be resolved automatically.

Here's a boilerplate webpage that I'm using


<html>
<head>
<script src="src/dojo/dojo.js" data-dojo-config="baseUrl: './src'"></script>
<script>

require({
    packages: [
        'dojo',
        'dojox',
        'dijit',
        'imjs'
    ]
},
[
    "imjs/js/im",
], function(im) {
    console.log("Loaded");
});
</script>
</head>
<body>
</body>
</html>

Along with a bower.json (installing into ./src)

{
  "name": "imjs-demo",
  "version": "1.0",
  "dependencies": {
    "dojo": "1.10.1",
    "dojox": "1.10.1",
    "dijit": "1.10.1",
    "imjs": "3.6.1"
  },
  "license": "MIT"
}


When I open the page I get

GET http://localhost/intermine-test/httpinvoke.js 404 (Not Found) dojo.js:325
Uncaught Error: xhrFailed



As a sidenote, I did have this working at one point and I forget what I had setup. If there is any advice on how to fix it again it would be greatly appreciated!

Thanks,
-Colin


_______________________________________________
dev mailing list
[hidden email]
http://mail.intermine.org/cgi-bin/mailman/listinfo/dev
Reply | Threaded
Open this post in threaded view
|

Re: Using imjs with AMD loader

Alex Kalderimis-2
In reply to this post by Colin
Just a quick question: are you getting imjs from NPM or bower?

imjs is bundled by browserify, using the UMD loader - but thanks for
the full webpage: I will try and use that to see if I can get imjs and
dojo working together.

Alex

On Wed, Oct 29, 2014 at 10:22:18AM -0500, Colin wrote:

> Hi all,
> I am currently trying to use the imjs API in the browser using AMD.
> Unfortunately it is throwing out some errors that I can't quite figure out,
> because I thought the dependencies would be resolved automatically.
>
> Here's a boilerplate webpage that I'm using
>
>
> <html>
> <head>
> <script src="src/dojo/dojo.js" data-dojo-config="baseUrl: './src'"></script>
> <script>
>
> require({
>     packages: [
>         'dojo',
>         'dojox',
>         'dijit',
>         'imjs'
>     ]
> },
> [
>     "imjs/js/im",
> ], function(im) {
>     console.log("Loaded");
> });
> </script>
> </head>
> <body>
> </body>
> </html>
>
> Along with a bower.json (installing into ./src)
>
> {
>   "name": "imjs-demo",
>   "version": "1.0",
>   "dependencies": {
>     "dojo": "1.10.1",
>     "dojox": "1.10.1",
>     "dijit": "1.10.1",
>     "imjs": "3.6.1"
>   },
>   "license": "MIT"
> }
>
>
> When I open the page I get
>
> GET http://localhost/intermine-test/httpinvoke.js 404 (Not Found)
> dojo.js:325
> Uncaught Error: xhrFailed
>
>
>
> As a sidenote, I did have this working at one point and I forget what I had
> setup. If there is any advice on how to fix it again it would be greatly
> appreciated!
>
> Thanks,
> -Colin

> _______________________________________________
> dev mailing list
> [hidden email]
> http://mail.intermine.org/cgi-bin/mailman/listinfo/dev


--
Alex Kalderimis
Software Developer
InterMine
Dept. of Genetics
University of Cambridge
[hidden email]

_______________________________________________
dev mailing list
[hidden email]
http://mail.intermine.org/cgi-bin/mailman/listinfo/dev
Reply | Threaded
Open this post in threaded view
|

Re: Using imjs with AMD loader

Alex Kalderimis-2
In reply to this post by Colin
Obviously I can reproduce your issue - I believe this is related to
an issue with browserify and the need to rewrite require calls:

 * https://github.com/substack/node-browserify/pull/598
 * https://github.com/pouchdb/pouchdb/issues/1208

I have just played around with this and fixed this issue in 3.6.3,
available immediately from bower and npm.

Alex

On Wed, Oct 29, 2014 at 10:22:18AM -0500, Colin wrote:

> Hi all,
> I am currently trying to use the imjs API in the browser using AMD.
> Unfortunately it is throwing out some errors that I can't quite figure out,
> because I thought the dependencies would be resolved automatically.
>
> Here's a boilerplate webpage that I'm using
>
>
> <html>
> <head>
> <script src="src/dojo/dojo.js" data-dojo-config="baseUrl: './src'"></script>
> <script>
>
> require({
>     packages: [
>         'dojo',
>         'dojox',
>         'dijit',
>         'imjs'
>     ]
> },
> [
>     "imjs/js/im",
> ], function(im) {
>     console.log("Loaded");
> });
> </script>
> </head>
> <body>
> </body>
> </html>
>
> Along with a bower.json (installing into ./src)
>
> {
>   "name": "imjs-demo",
>   "version": "1.0",
>   "dependencies": {
>     "dojo": "1.10.1",
>     "dojox": "1.10.1",
>     "dijit": "1.10.1",
>     "imjs": "3.6.1"
>   },
>   "license": "MIT"
> }
>
>
> When I open the page I get
>
> GET http://localhost/intermine-test/httpinvoke.js 404 (Not Found)
> dojo.js:325
> Uncaught Error: xhrFailed
>
>
>
> As a sidenote, I did have this working at one point and I forget what I had
> setup. If there is any advice on how to fix it again it would be greatly
> appreciated!
>
> Thanks,
> -Colin

> _______________________________________________
> dev mailing list
> [hidden email]
> http://mail.intermine.org/cgi-bin/mailman/listinfo/dev


--
Alex Kalderimis
Software Developer
InterMine
Dept. of Genetics
University of Cambridge
[hidden email]

_______________________________________________
dev mailing list
[hidden email]
http://mail.intermine.org/cgi-bin/mailman/listinfo/dev
Reply | Threaded
Open this post in threaded view
|

Re: Using imjs with AMD loader

Colin
Big thanks for this! I tested it briefly and it works fine in dojo now.

-Colin

On Thu, Oct 30, 2014 at 9:46 AM, Alex Kalderimis <[hidden email]> wrote:
Obviously I can reproduce your issue - I believe this is related to
an issue with browserify and the need to rewrite require calls:

 * https://github.com/substack/node-browserify/pull/598
 * https://github.com/pouchdb/pouchdb/issues/1208

I have just played around with this and fixed this issue in 3.6.3,
available immediately from bower and npm.

Alex

On Wed, Oct 29, 2014 at 10:22:18AM -0500, Colin wrote:
> Hi all,
> I am currently trying to use the imjs API in the browser using AMD.
> Unfortunately it is throwing out some errors that I can't quite figure out,
> because I thought the dependencies would be resolved automatically.
>
> Here's a boilerplate webpage that I'm using
>
>
> <html>
> <head>
> <script src="src/dojo/dojo.js" data-dojo-config="baseUrl: './src'"></script>
> <script>
>
> require({
>     packages: [
>         'dojo',
>         'dojox',
>         'dijit',
>         'imjs'
>     ]
> },
> [
>     "imjs/js/im",
> ], function(im) {
>     console.log("Loaded");
> });
> </script>
> </head>
> <body>
> </body>
> </html>
>
> Along with a bower.json (installing into ./src)
>
> {
>   "name": "imjs-demo",
>   "version": "1.0",
>   "dependencies": {
>     "dojo": "1.10.1",
>     "dojox": "1.10.1",
>     "dijit": "1.10.1",
>     "imjs": "3.6.1"
>   },
>   "license": "MIT"
> }
>
>
> When I open the page I get
>
> GET http://localhost/intermine-test/httpinvoke.js 404 (Not Found)
> dojo.js:325
> Uncaught Error: xhrFailed
>
>
>
> As a sidenote, I did have this working at one point and I forget what I had
> setup. If there is any advice on how to fix it again it would be greatly
> appreciated!
>
> Thanks,
> -Colin

> _______________________________________________
> dev mailing list
> [hidden email]
> http://mail.intermine.org/cgi-bin/mailman/listinfo/dev


--
Alex Kalderimis
Software Developer
InterMine
Dept. of Genetics
University of Cambridge
[hidden email]


_______________________________________________
dev mailing list
[hidden email]
http://mail.intermine.org/cgi-bin/mailman/listinfo/dev