TTUSDC / cpceed-webapp

CPCEED Web App
https://ttusdc.github.io/cpceed-webapp/
3 stars 0 forks source link

A few config changes #4

Closed asclines closed 7 years ago

asclines commented 7 years ago

These changes revolve around webpack. Is it possible to use webpack to build the backend as well? Seeing as they will be deployed together anyways. This will solve two problems I see:

In doing so I propose these changes to the NPM commands.

Going forward I do not see a reason to have two npm start-*s as starting the frontend without the backend would be pointless.

This is all done if the plan to make this one app, not two projects in one repo.

NilsG-S commented 7 years ago

@asclines Are you suggesting that we have Webpack bundle the back end together with the front end, or that we have the back end in its own bundle?

I agree with changing the NPM commands.

    "start": "npm-run-all start-api start-app",
    "start-app": "webpack-dev-server --env=dev",
    "start-api": "node server.js",

start-app is for development, rather than deployment. We could change start to node server.js and that would serve our purposes. These changes would allow us to eliminate start-api entirely.

asclines commented 7 years ago

@NilsG-S I'm not 100% sure as I am not that familiar with Webpack, I was hoping you could take this task on. From my understanding, it wouldn't make much sense to have a Webpack bundle for both the front end source code and the back end source code. But rather two bundles, one for building the front end and one for hosting the build with the back end.

NilsG-S commented 7 years ago

@asclines Your understanding is correct. I can look into setting Webpack up to build the back end as well. There are other advantages beyond non-relative pathing, like hot module replacement

asclines commented 7 years ago

I like it, please keep me updated on your progress.

NilsG-S commented 7 years ago

I'm looking into using nodemon to actually restart the server. As it is, Webpack with --watch enabled will rebundle the code when it changes, but the bundle won't be executed. nodemon would watch the bundle and restart it when it is updated.

asclines commented 7 years ago

@NilsG-S is there more to this issue that needs handling or can we mark this as resolved?

NilsG-S commented 7 years ago

Not that I can think of. Closing