-
Notifications
You must be signed in to change notification settings - Fork 70
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
refactor: enhance ssr in SPA mode #590
Conversation
// Return null directly if not matched | ||
if (_isNullableComponent(PageComponent)) return null; | ||
|
||
if (isWeb) { | ||
const navigationProps = Object.assign( | ||
{ staticConfig, component: PageComponent, history, location: history.location, routes, InitialComponent }, | ||
{ ...context.pageInitialProps }, | ||
{ staticConfig, component: PageComponent, history, location: history.location, routes, ...pageInitialProps }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
navigationProps = {...props}
const { appConfig, buildConfig = {}, createBaseApp, emitLifeCycles } = options; | ||
const { runtime, appConfig: modifiedAppConfig } = createBaseApp(appConfig, buildConfig, context); | ||
const { runtime, appConfig: modifiedAppConfig } = await createBaseApp(appConfig, buildConfig, context); | ||
|
||
options.appConfig = modifiedAppConfig; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
waring 看能不能顺手修复掉
@@ -0,0 +1,10 @@ | |||
export interface IInitialContext { | |||
pathname: string; | |||
query: any; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
query 类型尽量不用 any
|
||
config.merge({ | ||
devServer: { | ||
before(app, server) { | ||
// If originalDevServerBefore is before than midway, ssr will shut down | ||
if (typeof originalDevServeBefore === 'function') { | ||
originalDevServerBefore(app, server); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这样设置的情况下 如果有 mock 文件夹, faas 的 devServer 应该就失效了,逻辑要重新梳理下
* chore: bump version * feat: support mpa spm (#591) * feat: support global css file in mpa (#592) * refactor: enhance ssr in SPA mode (#590) * fix: ssr document mode error * chore: add test case * fix: midway plugin ssr * feat: support getInitialData * fix: page component getInitial props in spa * chore: add window fallback * chore: optimize code * chore: bump version (#597) * chore: bump beta version * chore: bump version * fix: preserve previous build dir (#596) * chore: bump version (#598) Co-authored-by: CattChen <42082890+ChenKS12138@users.noreply.github.com>
* chore: bump version * feat: support mpa spm (#591) * feat: support global css file in mpa (#592) * refactor: enhance ssr in SPA mode (#590) * fix: ssr document mode error * chore: add test case * fix: midway plugin ssr * feat: support getInitialData * fix: page component getInitial props in spa * chore: add window fallback * chore: optimize code * feat: support no document * feat: add document builder * chore: add local build plugin * chore: add emit * feat: no document with staticExport * feat: support hash in ssr * chore: revert example * chore: optimize code * chore: remove useless code
* chore: bump version * fix: data prefetches do not decamelize (#616) * [Refactor]: Document (#618) * chore: bump version * feat: support mpa spm (#591) * feat: support global css file in mpa (#592) * refactor: enhance ssr in SPA mode (#590) * fix: ssr document mode error * chore: add test case * fix: midway plugin ssr * feat: support getInitialData * fix: page component getInitial props in spa * chore: add window fallback * chore: optimize code * feat: support no document * feat: add document builder * chore: add local build plugin * chore: add emit * feat: no document with staticExport * feat: support hash in ssr * chore: revert example * chore: optimize code * chore: remove useless code * fix: app json content watch (#612) * Bump version (#620) * chore: bump version * chore: add changelog * chore: update version * chore: update version Co-authored-by: 岭伊 <zhengwang2314@gmail.com>
import { getInitailData } from 'rax-app'
Page.getInitialProps
in SPAcompileDependcies
is invalid in SSR