-
Notifications
You must be signed in to change notification settings - Fork 20
Server side rendering #871
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
8b7ba8f
prerender-spa-plugin [temporary commit]
2340d7d
add vue plugins
7a4b586
ssr plugin options
46ed3cc
changes after review
9abb305
fixes after the review
f697d38
fixes after the review
56715a7
pull from develop [temporary commit, todo: rebase]
3327214
fix createApp import error
c38fec5
compare with vue-reproductions repo
7f762e8
Merge branch 'develop' into feature/ssr_vuejs
745691f
switch of the store
3de2860
Merge branch 'feature/ssr_vuejs' of github.com:aeternity/superhero-ui…
3c707de
remove all components from render
4444990
remove all components from render
d3daf3f
remove useless parts
afc18ea
import vue to fix `npm run serve`
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| <!DOCTYPE html> | ||
| <html> | ||
| <head> | ||
| <meta charset="utf-8"> | ||
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
| <meta name="viewport" content="width=device-width,initial-scale=1.0"> | ||
| <link rel="icon" href="<%= BASE_URL %>favicon.ico"> | ||
| <title>{{ title }}</title> | ||
| {{{ renderResourceHints() }}} | ||
| {{{ renderStyles() }}} | ||
| </head> | ||
| <body> | ||
| <!--vue-ssr-outlet--> | ||
| {{{ renderState() }}} | ||
| {{{ renderState({ contextKey: 'apolloState', windowKey: '__APOLLO_STATE__' }) }}} | ||
| {{{ renderScripts() }}} | ||
| </body> | ||
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
|
|
||
| import { loadAsyncComponents } from '@akryum/vue-cli-plugin-ssr/client'; | ||
|
|
||
| import createApp from './main'; | ||
|
|
||
| createApp({ | ||
| async beforeApp ({ | ||
| router, | ||
| }) { | ||
| await loadAsyncComponents({ router }); | ||
| }, | ||
| afterApp({ | ||
| app, | ||
| router, | ||
| store, | ||
| }) { | ||
| store.replaceState(window.__INITIAL_STATE__); | ||
| router.onReady(() => { | ||
| app.$mount('#app'); | ||
| }); | ||
| } | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| import createApp from './main' | ||
|
|
||
| const prepareUrlForRouting = url => { | ||
| const { BASE_URL } = process.env | ||
| return url.startsWith(BASE_URL.replace(/\/$/, '')) | ||
| ? url.substr(BASE_URL.length) | ||
| : url | ||
| } | ||
|
|
||
| export default context => { | ||
| return new Promise(async (resolve, reject) => { | ||
| const { | ||
| app, | ||
| router, | ||
| store, | ||
| } = await createApp() | ||
|
|
||
| router.push(prepareUrlForRouting(context.url)) | ||
|
|
||
| router.onReady(() => { | ||
| context.rendered = () => { | ||
| // After all preFetch hooks are resolved, our store is now | ||
| // filled with the state needed to render the app. | ||
| // When we attach the state to the context, and the `template` option | ||
| // is used for the renderer, the state will automatically be | ||
| // serialized and injected into the HTML as `window.__INITIAL_STATE__`. | ||
| context.state = store.state | ||
|
|
||
| } | ||
| resolve(app) | ||
| }, reject) | ||
| }) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.