You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@royale.apache.org by GitBox <gi...@apache.org> on 2018/06/01 23:30:43 UTC

[GitHub] jgranick commented on issue #240: Generated ${body} has an invalid class reference on release

jgranick commented on issue #240: Generated ${body} has an invalid class reference on release
URL: https://github.com/apache/royale-asjs/issues/240#issuecomment-394034993
 
 
   This still is not working properly using newer builds.
   
   It may be something to do with the nature of trying to use external code. You can reproduce it using:
   
   ```
   git clone https://github.com/openfl/starling
   cd starling/samples/demo_npm/as3
   npm install
   npm start -s
   ```
   
   That works, but builds using the "debug" configuration. Trying to build for production, it fails to build properly:
   
   ```
   npm run build:prod -s
   // start a web server at bin/js-release
   ```
   
   By default, the project is using SWCs. If you want, you can point directly at *.as extern files by going into `asconfig.json` and using `source-path` instead of `external-library-path`:
   
   ```json
           "source-path": [
               "node_modules/openfl/lib",
               "node_modules/starling-framework/lib",
               "src"
           ],
   ```
   
   The compiler then throws an error about the `AssetPostProcessor` class inside `starling-framework/lib/starling/assets/AssetManager.as`, you can comment it out at the foot of the file.
   
   At runtime, it fails when it tries to create an instance of a class (such as `Demo`) that extends an external class type (such as `starling.display.Sprite`). Using `source-path`, here's what that looks like:
   
   ```js
   /* Royale Dependency List: */
   /**
    * Generated by Apache Royale Compiler from starling/display/Sprite.as
    * starling.display.Sprite
    *
    * @fileoverview
    * @externs
    *
    * @suppress {checkTypes|accessControls}
    */
   
   var starling = {};
   starling.display = {};
   
   goog.require('starling.display.DisplayObjectContainer');
   
   
   
   /**
    * @constructor
    * @extends {starling.display.DisplayObjectContainer}
    */
   starling.display.Sprite = function() {
     starling.display.Sprite.base(this, 'constructor');
   };
   goog.inherits(starling.display.Sprite, starling.display.DisplayObjectContainer);
   ```
   
   We support ES6 modules, CommonJS modules, or window references, but I don't think it's possible to use either ES6 modules or CommonJS modules from Apache Royale right now?
   
   I think that now it is properly getting a reference to `Main` in the release build, but we're hitting other problems when doing a release (instead of a debug) compile with Closure.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services