0

If I run the project locally with

ng serve -o

everything works as expected

However, once I build it (either dev or prod build) and deploy it to either an Azure web app or a local web server on my machine I get the error of

connectionContext.js:20 Uncaught TypeError: os__WEBPACK_IMPORTED_MODULE_2__.type is not a function - within connectionContext.js (from the azure event hubs SDK)

I performed

npm install

and all modules install but I still get the same error each time.

I am assuming something is added when running locally via the ng server but is not included within a build.

Is there anything to check for that I may have missed?

UPDATE: I have this running now by removing the functions that were causing the issue, not a fix more a hack to try and get progression. However, if I deploy to a local web server on my machine or to a raspberry pi it runs as expected. But when I deploy it to an azure web app it does not work as expected and states it cannot find 2 files (even though they can be seen via the FTP)

markblue777
  • 829
  • 3
  • 13
  • 28

1 Answers1

1

You need to create a web.config file in your wwwroot folder and add the MIME config like below to serve the JSON and WOFF files on Azure. You can check this similar thread.

<?xml version="1.0" encoding="UTF-8" ?>
<configuration>
    <system.webServer>
        <staticContent>
            <remove fileExtension=".json" />
            <remove fileExtension=".woff" />
            <remove fileExtension=".woff2" />
            <mimeMap fileExtension=".json" mimeType="application/json" />
            <mimeMap fileExtension=".woff" mimeType="application/font-woff" />
            <mimeMap fileExtension=".woff2" mimeType="application/font-woff" />      
        </staticContent>
    </system.webServer>
</configuration>

You can check angular deployment document fore more information,

Levi Lu-MSFT
  • 27,483
  • 2
  • 31
  • 43