Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8049843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T06:53:54+00:00 2026-06-05T06:53:54+00:00

I’ve got a problem since 3 days now with Google closure, because dependencies is

  • 0

I’ve got a problem since 3 days now with Google closure, because dependencies is made in the wrong order, i’ve got this :

main.js

(function () {
goog.provide('MYENGINE.Core');
goog.require('MYENGINE.engines.GraphicEngine');
goog.require('MYENGINE.engines.PhysicEngine');
goog.require('MYENGINE.engines.AudioEngine');
goog.require('MYENGINE.engines.GameEngine');

/*********************************
* @constructor
*
**********************************/
ENGINE.Core = function() 
{

};

})();

And this code (with the right names) :

(function () {
goog.provide('MYENGINE.engines.GraphicEngine');

/*********************************
* @constructor
*
**********************************/
MYENGINE.engines.GraphicEngine = function() 
{

};

})();

I don’t know why, but when i compilate this, “MYENGINE.engines.GraphicEngine” appears first before MYENGINE.Core.
So, when i run the page, i’ve got the error : *Uncaught ReferenceError: MYENGINE is not defined *

I use this code to compilate the project :

../extlib/closure/closure/bin/build/closurebuilder.py \
--root=../extlib/closure/ \
--root=../src \
--namespace="MYENGINE.Core" \
--output_mode=compiled \
--compiler_jar=compiler.jar \
> MYENGINE_min.js

In my “MYENGINE_min.js”, i can find the GraphicEngine’s creation before the core or initial namespace (MYENGINE), did i forgot to do something !?

Thanks a lot for your help !

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T06:53:56+00:00Added an answer on June 5, 2026 at 6:53 am

    Closure is designed such that you do not need to wrap each module in an anonymous function.
    Your error should go away if you remove the anonymous function wrappers. For example, main.js becomes:

    goog.provide('MYENGINE.Core');
    
    goog.require('MYENGINE.engines.GraphicEngine');
    goog.require('MYENGINE.engines.PhysicEngine');
    goog.require('MYENGINE.engines.AudioEngine');
    goog.require('MYENGINE.engines.GameEngine');
    
    /**
     * @constructor
     */
    MYENGINE.Core = function() 
    {
    
    };
    

    You also asked:

    I don’t know why, but when i compile this, “MYENGINE.engines.GraphicEngine” appears first before MYENGINE.Core.

    In MYENGINE.Core the line:

    goog.require('MYENGINE.engines.GraphicEngine');
    

    indicates that MYENGINE.Core depends on MYENGINE.engines.GraphicEngine. Therefore, MYENGINE.engines.GraphicEngine must appear first so that it is defined when called from MYENGINE.Core. For example, Closure’s base.js is usually the first source in the listing produced by Closure Builder, since all of the other Closure Library sources depend on base.js to bootstrap the library.

    If you would like to wrap the compiled JavaScript in an anonymous function for additional insurance against name collisions, the Closure Compiler provides the following flag:

    --output_wrapper    Interpolate output into this string at the place denoted 
                        by the marker token %output%.
    

    Using Closure Builder, the output wrapper would be specified on the command line as follows:

    --compiler_flags="--output_wrapper=(function(){%output%})();"
    

    In addition, setting the Compiler warning level to verbose will help catch additional errors at compile time:

    --compiler_flags="--warning_level=VERBOSE"
    

    The new build command would be:

    ../extlib/closure/closure/bin/build/closurebuilder.py \
    --root=../extlib/closure/ \
    --root=../src \
    --namespace="MYENGINE.Core" \
    --output_mode=compiled \
    --compiler_jar=compiler.jar \
    --compiler_flags="--output_wrapper=(function(){%output%})();" \
    --compiler_flags="--warning_level=VERBOSE" \
    > MYENGINE_min.js
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a jquery bug and I've been looking for hours now, I can't
I've got a string that has curly quotes in it. I'd like to replace
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
i got an object with contents of html markup in it, for example: string

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.