Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Docker - app.localize app.localize is not a function #6238


User avatar
0
cmthomps created

Trying to get AspNetZero 6.4 MVC Core/jQuery functioning inside a docker container. The docker container runs and the application loads in the browser, but it looks like some of the javascript isn't loading properly. On the login screen, I get two javasript errors:

  1. app.localize is not a function
  2. app.ModalManager is not a constructor

It's ok when I run it from the Visual Studio directly. I don't get those errors. I've tried running yarn and npm run create-bundles many times but I still get the same result in docker. I haven't modified the build-mvc.ps1 script at all.

Any thoughts?


14 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    Can you share a screenshot of chrome network and console?

  • User Avatar
    0
    cmthomps created

    This is what it looks like running through a docker container:

    Console (Docker)

    Network (Docker)

    This is the console running through the Visual Studio:

    Console (Visual Studio)

    Newtork (Visual Studio)

  • User Avatar
    0
    maliming created
    Support Team

    What is the content of this common-scripts.min.js file in docker?

  • User Avatar
    0
    cmthomps created

    This is what I got.

    common-scripts.min.js

  • User Avatar
    0
    maliming created
    Support Team

    The js file looks fine. Is it convenient to share your project or docker image?

  • User Avatar
    0
    cmthomps created

    Sure, where should I send them?

  • User Avatar
    0
    maliming created
    Support Team

    You can send it to my email:[email protected]

  • User Avatar
    0
    cmthomps created

    Just created a dropbox folder and invited you to share.

  • User Avatar
    0
    maliming created
    Support Team

    You can delete the build\outputs directory and re-run build\build-mvc.ps1 to compile the project and docker. (You can delete the docker container and image first.)

    It seems that the files packaged in docker are inconsistent with the external project.

  • User Avatar
    0
    cmthomps created

    Interesting. I still get the same result. I am building the site on a Mac, could that be the problem?

  • User Avatar
    0
    cmthomps created

    It seems as though the problem is the order of how the javascript files are getting bundled. In my case the culprit is librarySettings.js. It's getting inserted into the bundled file before app.localize is getting defined further down in the file. Is there a way to control the order of how the files get bundled?

    My "hack" solution was to exclude librarySettings.js in my first bundle and then add it in the next step.

    { "outputFileName": "wwwroot/view-resources/Areas/App/Views/_Bundles/common-scripts.js", "inputFiles": [ "wwwroot/Common/Scripts//*.js", "!wwwroot/Common/Scripts/librarySettings.js", "!wwwroot/Common/Scripts//*min.js", "!wwwroot/Common/Scripts/Chat/chat.signalr.js" ] }, { "outputFileName": "wwwroot/view-resources/Areas/App/Views/_Bundles/common-scripts.js", "inputFiles": [ "wwwroot/view-resources/Areas/App/Views/_Bundles/common-scripts.js", "wwwroot/Common/Scripts/librarySettings.js" ] },

  • User Avatar
    0
    maliming created
    Support Team

    @cmthomps please see: https://github.com/aspnetzero/aspnet-zero-core/issues/2113

  • User Avatar
    0
    cmthomps created

    @maliming thanks. I added a comment to the issue in github because I found other issues with the bundlconfig file.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Thanks @cmthomps. I'm closing this issue. You can continue from GitHub if you find any related problem.