Coder Social home page Coder Social logo

NodeInvocationException: document is not defined on initial project startup. But fine after refreshing page (F5) about jsstarterdocker HOT 4 OPEN

bharney avatar bharney commented on June 18, 2024
NodeInvocationException: document is not defined on initial project startup. But fine after refreshing page (F5)

from jsstarterdocker.

Comments (4)

bharney avatar bharney commented on June 18, 2024

Problem is associated with running the server side code before webpack is completed compilation. Additionally entire webpack is run when the webserver starts. Need to prevent this to resolve issue.

from jsstarterdocker.

 avatar commented on June 18, 2024

Do you think a multi-stage docker build might help with this? I'm not 100% familiar with your custom webpack build but I know the baked in Angular bundling is an after effect of successfully compiling the server code.

Would it be possible to trigger the webpack build in the Dockerfile manually before starting the server code compilation?
https://docs.docker.com/develop/develop-images/multistage-build/#before-multi-stage-builds

Essentially what I'm saying is can we strip this functionality from the .csproj and put it into the Dockerfile?

<!-- As part of publishing, ensure the JS resources are freshly built in production mode -->
    <Message Importance="high" Text="Performing npm install..." />
    <Exec Command="npm install" />
    <Message Importance="high" Text="Creating ClientApp/dist directory..." />
    <MakeDir Directories="ClientApp\dist\" />
    <Message Importance="high" Text="Creating react-loadable.json file..." />
    <WriteLinesToFile File="ClientApp\dist\react-loadable.json" Lines="{}" Overwrite="True" />
    <Exec Command="node node_modules/webpack/bin/webpack.js --config webpack.config.prod.js --env.prod" />
    <Exec Command="node node_modules/webpack/bin/webpack.js --config webpack.config.server.prod.js --env.prod" />
```XML

from jsstarterdocker.

bharney avatar bharney commented on June 18, 2024

@mtmulch I'd love to remove that setup from the .csproj file and into the docker build. I was trying to figure out at way to do that but no luck. I think this is one of the higher priorities for getting the project running correctly. Its a huge bug that the initial page load is an error message that requires a page refresh. Any help with trouble shooting/ PR is welcome. I would be stoked if this was resolved. 🌮

from jsstarterdocker.

 avatar commented on June 18, 2024

@bharney Hello friend, starting a new job this week that I might finally be able to call home and back in my own place in Chicago. I'm gonna take a look at some of this stuff soon on some nights when I'm bored.

from jsstarterdocker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.