Results 1 to 4 of 4

Thread: {build.environment} is not properly set in "sencha watch" for modern toolkit

    You found a bug! We've classified it as SDKTOOLS-1214 . We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #1

    Default {build.environment} is not properly set in "sencha watch" for modern toolkit

    Hi,

    I have an entry in my app.json to dynamically include a JS file depending on the build environment:

    Code:
    "js": [
         {
            "path": "app/config/environment/${build.environment}.js",
            "includeInBundle": true
          },
        ...
    ]
    
    I am developing an universal app. In the "classic" build, when running "sencha app watch", it feches "app/config/environment/development.js", as expected. But in the "modern" build, it fetches app/config/environment/production.js instead. I have checked both paths in Ext.manifest and it's just loading different values on classic and modern (in the same "sencha app watch" execution).

    I have tried to force environment with "sencha app watch -e development" but it doesn't work that way either.

    Using Sencha Cmd v6.0.0.202.

    Another related question, which is the idiomatic way with Sencha to load custom properties that change with the environment? I came with this dynamic js file trick but perhaps there is a directly supported way I am missing.

    Thanks and kudos for the amazing job with sencha 6.

  2. #2
    Sencha - Engineering israelroldan's Avatar
    Join Date
    Nov 2011
    Location
    The Netherlands
    Posts
    395

    Default

    The right way to do this is to add a js block into the "development", "testing" and "production" blocks of app.json, you can put almost all properties of app.json into these blocks to have environment-specific settings, arrays and objects will be merged with the ones at the root level.
    Israel Roldán | Senior Software Engineer (Framework tools)

  3. #3

    Default

    Hi,

    Thanks for the tip Israel. I already tried that but it doesn't work for custom properties I need for my app. For example, the "server url property" will vary across environments. Is there a way to define custom properties across environments?

    Independently of this, the bug report I wrote is still a valid one I think if you want to track it. The {build.environment} property is not properly set for modern builds with sencha watch.

    Thanks

  4. #4
    Sencha - Engineering israelroldan's Avatar
    Join Date
    Nov 2011
    Location
    The Netherlands
    Posts
    395

    Default

    You're right, I forgot to mention that, sorry. I filed SDKTOOLS-1214 to address this issue with the value of ${build.environment}.

    Now, what have you tried (with regards to the custom property) that doesn't work? You can read properties from app.json with Ext.manifest, for example:
    Code:
    {
        "example": "Foo",  // You can retrieve this with Ext.manifest["example"]
        "development": {
            "test": "Bar" // Ext.manifest["test"] ("test" and not "development.test" because everything under "development|testing|production" gets merged back to the root of the appropriate environment)
        }
    }
    Israel Roldán | Senior Software Engineer (Framework tools)

Similar Threads

  1. Replies: 7
    Last Post: 5 Jun 2015, 2:55 PM
  2. Toolkit "modern" not found
    By HorusDev in forum Ext JS 6.x Q&A
    Replies: 1
    Last Post: 7 May 2015, 8:11 AM
  3. Error BUILD FAILED, when run "sencha app watch"
    By edaniel15 in forum Sencha Cmd
    Replies: 1
    Last Post: 20 Nov 2014, 2:12 PM

Posting Permissions

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