V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
qxn
V2EX  ›  React

整理了一下 react16.7.0 的 webpack 模板

  •  
  •   qxn ·
    qianxiaoning · 2019-06-23 12:47:36 +08:00 · 1724 次点击
    这是一个创建于 1740 天前的主题,其中的信息可能已经有所发展或是发生改变。

    基本上 react 需要方法和依赖的库都引配好了。github 地址: https://github.com/qianxiaoning/demo-react16.7.0 欢迎大家 star 或者 fork 呀~

    template-antDesign-sass-react16.7.0

    • 目录结构
    build/ 生成目录
    public/ 静态资源目录,create-react-app 会直接把这里的东西起在服务根目录
    src/
        assets/ 资源文件夹,如图片
        components/ 组件
            ReactSlotPra 弹窗组件,引用父组件传入的 slot 数据
            ReduxSon redux 的修改
            Son 事件总线的发射
        config/ 参数文件夹
        pages/ 页面文件夹
            Home 1.react 中 input 的写法
                 2.react 中组件 slot 的实现方式
            News react 中组件 slot 的实现方式
            Product 嵌套路由的实现
            ParentSonTransmit 1.父子通讯的方式
                              2.事件总线的监听与销毁
            ReduxExperience redux 的引用
            HocPra 使用 hoc 高阶组件的公共方法
            HttpPra 1.axios 请求试验
                    2.引入 antd 库
        redux/ redux 文件夹
        router/ router 配置
        structures/ 结构组件
        utils/
            events.js 事件总线模块
            hoc.js hoc 高阶组件(也可以写一些公共的东西,用来替代 mixins )
            http.js http 请求和 antd 的 loading,message 的结合封装
            urls.js 接口地址的统一管理
            utils.js 公共方法,工具函数
        AppNote.js 笔记文件
        index.js 入口文件
        index.scss 公共样式
    config-overrides.js customize-cra 对 create-react-app 的 webpack 的可配置,如为了 antd 配置了 babel-plugin-import
    jsconfig.json create-react-app 的配置文件,现在只配了项目资源可以绝对路径
    package.json proxy 设置的地方
    
    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5476 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 07:12 · PVG 15:12 · LAX 00:12 · JFK 03:12
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.