美文网首页React.jsWeb前端之路Web 前端开发
快速搭建react开发环境:react-create-fast

快速搭建react开发环境:react-create-fast

作者: AlwaysVe | 来源:发表于2017-12-08 11:54 被阅读59次

这是自己撸的一个react脚手架

使用了代码分片按需加载DLL等方式来优化项目,所以你不用为项目过大而烦恼。

并且将webpack配置全部暴露出来,你可以根据自己的喜好去修改。

github地址:https://github.com/Vibing/rea...(听说点star的人都是好人😄😄😄)


react-create-fast

一个让你快速搭建react开发环境的脚手架

安装及使用:
  1. npm install react-create-fast -g
  2. react-create-fast [projectName]
启动项目:
  1. cd [projectName]
  2. yarnnpm install
  3. npm run dll
  4. npm start

在浏览器地址栏中输入:localhost:3000即可访问

项目打包,运行npm run build即可,项目将打包至dist文件夹内

默认使用技术栈:
  1. react
  2. typescript
  3. antd
  4. styled-components
  5. react-router-dom
  6. immutable

你可以根据喜好来installuninstall它们。


建议:

项目公共样式(包括antd、框架、装饰页)使用less,页面级样式采
styled-components,以防止样式污染。


DLL :

webpack.dll.config.babel.js中,默认打包的公共包包括:

entry: {
    vendor: ['react', 'react-dom', 'antd', 'react-router-dom', 'immutable']
  }

你可以根据自己的喜好做删减

相关文章

网友评论

    本文标题:快速搭建react开发环境:react-create-fast

    本文链接:https://www.haomeiwen.com/subject/ywheixtx.html