1
votes

having some strange loading error and i dont know why:

my project:

index.php
     js/
        libs/
            require.js
            backbone.js
            jquery.js
            modernizr.js
            lodash.js
            selectivzr.js
            ..a lot more .js files
        templates/
            bunch of .html files...
        views/
            bunch of views...
     config.js
     main.js

my config.js:

require.config({
   deps: ["main"],
   baseUrl: "/js",

   paths: {
      jquery: "/libs/jquery.min",
      lodash: "/libs/lodash.min",
      backbone: "/libs/backbone.min",
     ...a lot more
  },

   shim: {
     backbone: {
        deps: ["lodash", "jquery", "modernizr", etc etc],
        exports: "backbone"
     }
  }

});

now i get 2 strange error messages when i try to run it:

1) "NetworkError: 404 Not Found - localhost/js/main.js"

and

2) Error: Script error http://requirejs.org/docs/errors.html#scripterror

does anyone know whats wrong?

1
main.js is not located inside your js folder. remove the baseUrl - ashley
It's not a strange error, it just can't load a file.. is main.js inside js folder? - andygoestohollywood
@andygoestohollywood yes, main.js is inside js folder - SHT
@ashley when i remove the baseurl, it cannot find the other .js files which are in the libs folder - SHT

1 Answers

0
votes

/js is not at the root of your webserver..

so do:

 baseUrl: "js/",