Open bharney opened 5 years ago
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.
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
@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. 🌮
@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.
Force VS Build to wait for Webpack Completion before displaying page
NodeInvocationException: document is not defined
on page load. However if you wait until webpack build completes and refresh the page, everything loads fine. Super irritating.