Results 1 to 6 of 6

Thread: Does ExtJs 6.5 support ES6 template literals?

  1. #1
    Sencha Premium User
    Join Date
    Sep 2010
    Location
    UK
    Posts
    135

    Default Does ExtJs 6.5 support ES6 template literals?

    I have two pages in my ExtJs 6.5 modern project. Both have custom HTML contents. One HTML content is constructed with multiple lines concatenated with '+' symbol. Another page uses ES6 template literal.

    When I publish the modern project, both pages work fine. However, when I do "Build & Emulate", the page with template literal is blank on both Android & iOS, whereas the one concatenated with '+' symbol appears fine. I use a web browser to connect to the webview to inspect the JS script source (I disabled the compress mode) and the template literal is empty (``).

  2. #2

    Join Date
    Feb 2011
    Location
    Chisinau, Moldova
    Posts
    316
    Answers
    64

    Default

    I noticed the same issue. It seems to be a Sencha CMD bug. I wanted to leverage the multi-line string capability of template literals, but after building the application for production, in the place where there was the template literal, is an empty string. This is not happening for all template literals though. Those with expression interpolation are built just fine, but those without are replaced by empty strings. Here is the test case I've used:


    Code in development:
    Code:
    let name = 'John';
    Ext.toast({
      title: `Hello ${name}`,
      html: `Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula
    eget dolor. Aenean massa.`
    });



    Code in production after "sencha app build":
    Code:
    var a = 'John';
    Ext.toast({
      title: 'Hello ' + a,
      html: ''
    })

  3. #3
    Sencha Premium User
    Join Date
    Apr 2007
    Location
    New Jersey
    Posts
    88
    Answers
    1

    Default

    I filed a bug report on this about a month ago. Haven't heard anything back yet other than that an issue has been created. I'm not seeing any progress on a fix, however. This morning I sent an request for an update as I'm stuck unable to deploy a packaged application until this is fixed.

    I created a project and put it on github to demonstrate the problem --> https://github.com/bobringer/template-literals

    My next option is to attempt this --> https://www.sencha.com/forum/showthread.php?331255

  4. #4
    Sencha Premium User
    Join Date
    Apr 2007
    Location
    New Jersey
    Posts
    88
    Answers
    1

    Default

    I use template literals without interpolation everywhere, so I can use multiline strings. I can't just replace these with regular strings.

    @chramer, the good news (for me at least) is that you hit on a scenario that provides a pretty simple workaround.

    I'm just making it a habit of adding ${""} to the front of every template literal. Not ideal, but until we get a fix, it does the job without side effects.

  5. #5

    Join Date
    Feb 2011
    Location
    Chisinau, Moldova
    Posts
    316
    Answers
    64

    Default

    @bobringer, thanks for the tip! Indeed, it works like that. I hope they fix this in the next CMD update. This is not the kind of habit I would like to adopt

  6. #6
    Sencha Premium User
    Join Date
    Apr 2007
    Location
    New Jersey
    Posts
    88
    Answers
    1

    Default

    According to Sencha, it should be fixed in one of the nightly builds in the next day or two (or last night, I haven't had a chance to check yet.)

    It should certainly be in 6.5.1

Similar Threads

  1. Needs support for folders, documentation, refactoring, roundtrip, template files, etc
    By interfasys in forum Sencha Architect 2.x: Help & Discussions
    Replies: 3
    Last Post: 17 Feb 2012, 3:18 PM
  2. Only class literals may be used as arguments to GWT.create()
    By yh800701 in forum Ext GWT: Discussion
    Replies: 3
    Last Post: 17 May 2010, 7:50 AM
  3. jsonstore and object literals
    By a06mikkl in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 27 Apr 2010, 1:22 PM
  4. Time Format with Literals Problem...
    By WixSL in forum Ext 2.x: Help & Discussion
    Replies: 3
    Last Post: 4 Oct 2009, 12:35 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
  •