none
Publish to Azure Cloud Service ignores TypeSript-generated JavaScript files

    Question

  • I have just published a major update to an existing Cloud Service application, in which I have started to shift to the use of TypeScript (TS).

    When I publish and execute the application, I see that my app cannot locate many of the JavaScript (JS) files that have been generated by the TS compiler:
    - The files are there in the development environment
    - In fact an entire folder tree (e.g. ~/scripts/ts/…/…/code.js) has been omitted.

    When I manualy copy the JS files onto the server in the correct folder structure, the application works.

    When I "Package" the application locally and inspect the folder structure, I can see that the files (and folders) do not exist.

    How is it possible that you can omit such VITAL files as part of the Azure Package/Publish process?

    Tuesday, February 12, 2019 1:40 AM

All replies

  • Where are these files located in the structure of the cloud service? 

    Can you share a screenshot?

    Tuesday, February 12, 2019 8:20 PM
    Moderator
  • The files are located off of the standard Scripts folder as per above, e.g. "~/Scripts/ts/<folder name>/<code.ts>".

    After hours of battling, I seem to have stumbled onto a stable config where the files are copied across:
    - I tried to add "dummy" .js files into those folders - didn't work.
    - I found this link (https://github.com/Microsoft/TypeScript/issues/6570) and tried the recommendations - didn't work.

    I finally edited the tsconfig.json file and added an explicit Include section for "scripts/**/*".
    Shortly after this change, the generated .js files started copying across.

    I don't know whether that config is required or even referenced by the Azure packager or even made any difference, but since that change the publishing seemed to work properly.

    Hours of valuable time wasted and lost during a critical time with a silly and completely unnecessary error IMO...

    Tuesday, February 12, 2019 8:37 PM
  • Thanks for the update Elroy. I also found some suggestions to manually include them such as you found. Glad to hear at least it worked for you and you can move forward. I am unsure why they would not be included to begin with as that does seem odd. 

    If you are interested in digging deeper into this issue, I can get you in touch with support to help take a look at the configuration. 

    Tuesday, February 12, 2019 8:59 PM
    Moderator
  • Hi Micah,

    I am not happy with the wasted time and effort that it took to resolve this at all, so I'd like to understand EXACTLY what went wrong and why. If you're prepared to commit to an OPEN and transparent engagement, then I'd like to pursue that option.

    Given the above, I remembered one other change that I made - see attached.

    I created a very simple Cloud Service project and I am now able to re-create the problem.

    Any idea of how the attached configuration could impact on the inclusion of generated .js files during Azure packaging?
    - "Enable project references" results that generated .js files (and their containing folders) are NOT copied across.
    - when you disable the setting then the files ARE copied across in their folders...

    JS file NOT packaged -

    JS files packaged -

    JS files packaged - contents of


    • Edited by Elroy Heynes Tuesday, February 12, 2019 9:25 PM
    • Marked as answer by Elroy Heynes Tuesday, February 12, 2019 9:27 PM
    • Unmarked as answer by Elroy Heynes Tuesday, February 12, 2019 9:27 PM
    Tuesday, February 12, 2019 9:16 PM
  • Can you click on the "Learn More" link next to it and share it with me? 
    Tuesday, February 12, 2019 9:30 PM
    Moderator
  • Here is the url:  https://www.typescriptlang.org/docs/handbook/project-references.html

    I had a read but nothing particularly stood out for me re this issue and packaging in general.
    It is worth clarifying that all JS files were generated (compiled) correctly and the application clearly ran correctly locally and in the emulator.
    The problem is clearly related to the packaging of those generated files for Azure...


    Tuesday, February 12, 2019 9:32 PM
  • Yeah I am not sure if the issue is directly related to using TypeScript or if other languages see the same thing... 

    First, I would suggest you open an issue here

    https://github.com/Microsoft/TypeScript/issues

    You can CC me on the issue using MicahMcKittrick-MSFT

    I can see if I can get someone from the TypeScript team to take a look and maybe shed some light on this. This is likely the best place to start the conversation and we can always bring in others if needed. 

    Tuesday, February 12, 2019 9:50 PM
    Moderator
  • Hi Micah,

    Issue loaded as requested: https://github.com/Microsoft/TypeScript/issues/29888

    Thanks,
    Elroy.

    Wednesday, February 13, 2019 6:14 AM