Giter Site home page Giter Site logo

react-universal-ssr's Introduction

React-universal-ssr

webpack+router4+按需加载+webpack-dev-server

开发环境使用webpack-dev-server做服务端,实现热加载,生产环境使用koa做后端,实现按需加载,页面渲染前加载数据 具体介绍可以查看 https://juejin.im/post/5a392018f265da431b6d5501

  1. npm install
  2. npm start 运行开发版环境

  1. npm install
  2. npm run build 生产环境编译 dist/client+dist/server
  3. npm run server 运行koa

想了解更多可以看下 https://github.com/tzuser/ssr ,不同风格,同样的功能,也是用的 react16+router5+koa2

react-universal-ssr's People

Contributors

wd2010 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

react-universal-ssr's Issues

dev server

有考虑dev下的服务端渲染吗,也是说利用webpack memery-fs实现服务端渲染的热更新开发

路由是:id这样的,然后actions获取动态参数的不能服务端渲染

如题
路由配置代码:

const LoadableAnimeDetail = Loadable({
  loader: () => import(/* webpackChunkName: 'detail' */'../../containers/detail'),
  loading: Loading,
});

// ------------------

{
  path: '/anime/:id',
  exact: true,
  component: LoadableAnimeDetail,
  thunk: detailThumk,
}

localhost:8080/anime/13213 可以正常访问,但用dev:server的时候,没有服务端渲染成功。不是动态获取参数的可以正常渲染。

看了一圈子,不知道从哪里改,有空的时候可以看一下,还是我哪里配置对。

npm start 运行开发版环境报错

Uncaught TypeError: composeEnhancers is not a function
at configureStore (configureStore.js:12)
at Object.defineProperty.value (index.js:9)
at webpack_require (bootstrap b050f17ff53e314e8635:712)
at fn (bootstrap b050f17ff53e314e8635:117)
at Object. (web.dom.iterable.js:19)
at webpack_require (bootstrap b050f17ff53e314e8635:712)
at webpackJsonpCallback (bootstrap b050f17ff53e314e8635:25)
at client.b050f17f.js:1

异步函数语法报错

启动npm run server的时候async语法报错:
return async (ctx, next) => {
^
SyntaxError: Unexpected token (
at Object.exports.runInThisContext (vm.js:76:16)
... 这怎么解决?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.