Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Senior Coder nikos101's Avatar
    Join Date
    Dec 2006
    Location
    London
    Posts
    1,007
    Thanks
    59
    Thanked 10 Times in 10 Posts

    Question RequireJs question

    Hi in my main.js (used by require.js) what do I need to add to this:

    define('GameObjects', ['GameObjects.js']);

    to get this error to go away:

    Uncaught ReferenceError: exports is not defined GameObjects.js:82
    Uncaught Error: Module name "GameObjects" has not been loaded yet for context: _. Use require([])

    my loading page looks like this:

    <script language="javascript" src="javascripts/require.js" type="text/javascript" data-main="ts/main.js"> </script>
    <script language="javascript" src="javascripts/jquery-1.8.2.min.js" type="text/javascript"> </script>
    <script language="javascript" src="ts/GameObjects.js" type="text/javascript"> </script>
    <script language="javascript" src="ts/game.js" type="text/javascript"> </script>


  • #2
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,401
    Thanks
    11
    Thanked 595 Times in 575 Posts
    you might need to run their special copy of jQuery, or re-build from the command line.
    at any rate, GameObjects can't be it's own requirement, that doesn't compute.

    you should list the files GameObjects needs in the 1st-argument as an array.

    all this said, i find the whole system quite confusing. There's lots of options, but little example code or documentation explaining how each piece works.
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/9/03) IE7:0.1, IE8:4.6, IE11:9.1, IE9:3.1, IE10:3.0, FF:17.2, CH:46, SF:11.4, NON-MOUSE:38%


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •