Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of Problem
Right now SSR Guide uses an
app.js
as a common place to create an SSR app. I think this is a more than ok approach for prototyping, but for an actual production code it also has two issues that I'd like to solve:vue-router
for example) with an app could be different from another. These types of integration could differ significantly depending on the environment (server or client). That adds complexity to theapp.js
code, which should know that it can be used in both environments and have a condition for each case that is different on client\server.false
for the client build so it might actually tree-shake these dependencies. I would consider that a hack rather than a proper solution to the problem.Proposed Solution
We can disregard
app.js
and write client and server instantiation code separately from each other. That way we solve two problems at once: no need for special handling for each type of client\server integration, automatic full tree-shaking.Additional Information
I also think this is a good place to start for everyone trying out SSR for the first time, since if this in fact limits the codebase significantly (for example there's a case of a lot of code duplication) you can easily switch to the current approach.