Run on server(tomcat) return white empty page.
Opened this issue · 5 comments
In development, you should go to localhost:3000 to see the frontend dev server.
It creates a proxy to localhost:8080 so you can access everything from here.
It can be a little bit confusing at first, because in production, you add the static resources in the jar and use the SinglePageAppConfig
to resolve them.
At the moment, the big advantage of doing this is we do not have to write anything to disk when we run in dev.
This could be fixed if we decide to write the generated files of the frontend dev server to disk and tell the SinglePageAppConfig
to use this directory in dev.
This would probably make the build process less 'magical'.
I'm keeping this open for now.
I also get an empty page and I don't know what to expect! I created a pull request that upgrades this project to the latest and greatest. Please review and use and help out!
Well I guess one way to solve this would be including a controller that redirects to localhost:3000 in dev...
This is what I did to get 8080 to serve the production build. This way works with development and also gets in Spring Boot assembled JAR.
backend/build.gradle
classes.dependsOn(':frontend:assemble')
frontend/build.gradle
task bundle(type: YarnTask) {
args = ['build']
}
task start(type: YarnTask) {
args = ['start']
}
task test(type: YarnTask) {
args = ['test']
}
task copyBackend(type: Copy) {
from 'build'
into project(':backend').file('src/main/resources/static')
}
//check.dependsOn(test)
bundle.dependsOn(yarn_install)
assemble.dependsOn(copyBackend)
copyBackend.dependsOn(bundle)
I just got this working and don't know if it's the best solution.
@MikeSuiter Correct me if I am wrong but, I think the point of having a front-end with port 3000 server was to support React-hot-reloading. If you run the gradle task in production mode, it should create a fat jar which is then accessible on localhost:8080.
@oakstair could you check the console, for some errors. If you upgraded to the latest and greatest. There were a lot of methods in webpack.config that are now deprecated. So that might break some workings.