easy-team / easywebpack-react

React Webpack Building Solution, Support React Server Side Render (SSR), Client Side Render (CSR) Building
http://easyjs.cn/easywebpack
MIT License
15 stars 8 forks source link

请问easywebpack对于react ssr有没有做代码拆分处理?哪里能找到相关文档? #1

Closed beijipc closed 5 years ago

beijipc commented 6 years ago

请问easywebpack对于react ssr有没有做代码拆分处理?哪里能找到相关文档?

hubcarl commented 6 years ago

@beijipc 具体要拆分什么? commonChunk 和 dll 都支持, tree shaking 和异步加载 是 webpack 构建支持

hubcarl commented 5 years ago
import React, { Component } from 'react';
import Loadable from 'react-loadable';
import Loading from '../widget/loading';

const AsyncImageLoadableComponent = Loadable({
  loader: () => import('../widget/async-image'),
  loading: Loading,
});

export default class About extends Component {

  render() {
    return <div>
      <h3 className="spa-title">Egg + React + Redux + React Router SPA Server Side + Webpack Render Example</h3>
      <div style={{ 'text-align': 'center' }}><AsyncImageLoadableComponent /></div>
    </div>;
  }
}

这种异步加载是支持的